Best Python code snippet using autotest_python
test_migrations.py
Source:test_migrations.py
...57 self._check_141 = mock.MagicMock()58 self.migrate_up(141, True)59 self._pre_upgrade_141.assert_called_with(self.engine)60 self._check_141.assert_called_with(self.engine, test_value)61 def test_migrate_down(self):62 self.migration_api.db_version.return_value = 4263 self.assertTrue(self.migrate_down(42))64 self.migration_api.db_version.assert_called_with(65 self.engine, self.REPOSITORY)66 def test_migrate_down_not_implemented(self):67 with mock.patch.object(self.migration_api,68 'downgrade',69 side_effect=NotImplementedError):70 self.assertFalse(self.migrate_down(self.engine, 42))71 def test_migrate_down_with_data(self):72 self._post_downgrade_043 = mock.MagicMock()73 self.migration_api.db_version.return_value = 4274 self.migrate_down(42, True)75 self._post_downgrade_043.assert_called_with(self.engine)76 @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_up')77 @mock.patch.object(migrate.WalkVersionsMixin, 'migrate_down')78 def test_walk_versions_all_default(self, migrate_up, migrate_down):79 self.REPOSITORY.latest = 2080 self.migration_api.db_version.return_value = self.INIT_VERSION81 self.walk_versions()82 self.migration_api.version_control.assert_called_with(83 self.engine, self.REPOSITORY, self.INIT_VERSION)84 self.migration_api.db_version.assert_called_with(85 self.engine, self.REPOSITORY)86 versions = range(self.INIT_VERSION + 1, self.REPOSITORY.latest + 1)87 upgraded = [mock.call(v, with_data=True)88 for v in versions]...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!