def test_object_migration(self): # individual migration a = TestObject() Exodus.migrate_object(a) assert hasattr(a, 'b') b = AnotherObject() Exodus.migrate_object(b) assert not hasattr(b, 'b')
def test_exodus(self): adapter = DictAdapter({ 'a': [jaweson.dumps(TestObject()) for x in range(10)], 'b': [jaweson.dumps(AnotherObject()) for x in range(5)], }) Exodus.migrate_database(adapter) assert set(adapter.db.keys()) == set(['b', 'c', 'version']) assert len(filter(lambda obj: 'b' in obj, adapter.db['c'])) == len(adapter.db['c']) assert adapter.db['version'] == Exodus.highest_version()
def test_object_migration(self): # individual migration a = json.loads(jaweson.dumps(TestObject())) assert 'b' not in a a = Exodus.migrate_object(a) assert 'b' in a b = json.loads(jaweson.dumps(AnotherObject())) assert 'b' not in b Exodus.migrate_object(b) assert 'b' not in b
def setUp(self): Exodus.load_migrations('tests/jaweson_migrations') # import the migrations AFTER we initialise exodus self.migration1 = importlib.import_module('tests.jaweson_migrations.2015_03_10_add_b').Migration self.migration2 = importlib.import_module('tests.jaweson_migrations.2015_10_10_move_keys').Migration
def test_reload(self): assert len(Exodus.migrations) == 2 Exodus.migrations = None Exodus.load_migrations('tests/migrations') assert len(Exodus.migrations) == 2