Best Python code snippet using tempest_python
test_migrations.py
Source:test_migrations.py
...20 def setUp(self):21 super(MigrationsTest, self).setUp()22 self.cs = fakes.FakeClient(api_versions.APIVersion("2.1"))2324 def test_list_migrations(self):25 ml = self.cs.migrations.list()26 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)27 self.cs.assert_called('GET', '/os-migrations')28 for m in ml:29 self.assertIsInstance(m, migrations.Migration)30 self.assertRaises(AttributeError, getattr, m, "migration_type")31 self.assertRaises(AttributeError, getattr, m, "uuid")3233 def test_list_migrations_with_filters(self):34 ml = self.cs.migrations.list('host1', 'finished')35 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)3637 self.cs.assert_called(38 'GET',39 '/os-migrations?host=host1&status=finished')40 for m in ml:41 self.assertIsInstance(m, migrations.Migration)4243 def test_list_migrations_with_instance_uuid_filter(self):44 ml = self.cs.migrations.list('host1', 'finished', 'instance_id_456')45 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)4647 self.cs.assert_called(48 'GET',49 ('/os-migrations?host=host1&'50 'instance_uuid=instance_id_456&status=finished'))51 self.assertEqual(1, len(ml))52 self.assertEqual('instance_id_456', ml[0].instance_uuid)535455class MigrationsV223Test(MigrationsTest):56 def setUp(self):57 super(MigrationsV223Test, self).setUp()58 self.cs.api_version = api_versions.APIVersion("2.23")5960 def test_list_migrations(self):61 ml = self.cs.migrations.list()62 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)63 self.cs.assert_called('GET', '/os-migrations')64 for m in ml:65 self.assertIsInstance(m, migrations.Migration)66 self.assertEqual(m.migration_type, 'live-migration')67 self.assertRaises(AttributeError, getattr, m, "uuid")686970class MigrationsV259Test(MigrationsV223Test):71 def setUp(self):72 super(MigrationsV259Test, self).setUp()73 self.cs.api_version = api_versions.APIVersion("2.59")7475 def test_list_migrations(self):76 ml = self.cs.migrations.list()77 self.assert_request_id(ml, fakes.FAKE_REQUEST_ID_LIST)78 self.cs.assert_called('GET', '/os-migrations')79 for m in ml:80 self.assertIsInstance(m, migrations.Migration)81 self.assertEqual(m.migration_type, 'live-migration')82 self.assertTrue(hasattr(m, 'uuid'))8384 def test_list_migrations_with_limit_marker_params(self):85 marker = '12140183-c814-4ddf-8453-6df43028aa67'86 params = {'limit': 10,87 'marker': marker,88 'changes_since': '2012-02-29T06:23:22'}89
...
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!!