getting file size for all dict files to be downloaded. coming to be 400mb or so.
[worddb.git] / libs / dmigrations / tests / .svn / text-base / migration_log.py.svn-base
blob6d398aef6949d2ff92ebbc3578e7a842e8b24eb0
1 from dmigrations.tests.common import *
2 from dmigrations.migration_state import MigrationState
3 from dmigrations.migration_db import MigrationDb
4 from dmigrations.migration_log import get_log
5 from datetime import datetime, date, time
7 class MigrationLogTest(TestCase):
8   def set_up(self):
9     from django.db import connection
10     self.cursor = connection.cursor()
12     for sql in [
13       "DROP TABLE smigrations_schema",
14       "DROP TABLE migrations",
15       "DROP TABLE migrations_log",
16       "CREATE TABLE mock (id INTEGER NOT NULL)"]:
17       try: self.cursor.execute(sql)
18       except: pass
20   def tear_down(self):
21     self.cursor.execute("DROP TABLE mock")
23   def test_when_doing_something_then_loggged(self):
24     db = MigrationDb(directory=self.mock_migrations_dir)
25     db.warn = WarningsMocker()
26     si = MigrationState(migration_db=db, dev=True)
27     si.init()
29     si.apply('001_foo')
30     si.mark_as_unapplied('001_foo')
31     si.apply('001_foo')
32     si.mark_as_applied('005_omg')
33     si.unapply('001_foo')
35     self.assert_equal(
36       [
37         ("apply", "001_foo", "success"),
38         ("mark_as_unapplied", "001_foo", "success"),
39         ("apply", "001_foo", "success"),
40         ("mark_as_applied", "005_omg", "success"),
41         ("unapply", "001_foo", "success"),
42       ], [row[:3] for row in get_log()]
43     )
44     self.assert_equal(True, isinstance(get_log()[0][3], datetime))