Exemplo n.º 1
0
    def test_run_migration(self):
        self.setup_migrations()
        migration.run_migration('20100901T100000-first-one')

        h.assert_equal(migration.current_version(),
                       '20100901T100000-first-one')

        h.assert_equal(mongo.db.foobar.find_one()['foo'], 'bar')
Exemplo n.º 2
0
    def test_run_migration_wrongway(self, vers_mock):
        self.setup_migrations()
        vers_mock.return_value = '20100901T100001-CAPITALS'

        # Should raise with force=False
        h.assert_raises_regexp(migration.MigrationError,
                               "less than or the same as",
                               migration.run_migration,
                               '20100901T100000-first-one')

        # Should not raise
        migration.run_migration('20100901T100000-first-one', force=True)