Best Python code snippet using tempest_python
test_verify_tempest_config.py
Source:test_verify_tempest_config.py
...196 verify_tempest_config.verify_glance_api_versions(fake_os, True)197 print_mock.assert_called_once_with('api_v1', 'image_feature_enabled',198 False, True)199 def test_verify_extensions_neutron(self):200 def fake_list_extensions():201 return (None, {'extensions': [{'alias': 'fake1'},202 {'alias': 'fake2'},203 {'alias': 'not_fake'}]})204 fake_os = mock.MagicMock()205 fake_os.network_client.list_extensions = fake_list_extensions206 self.useFixture(mockpatch.PatchObject(207 verify_tempest_config, 'get_enabled_extensions',208 return_value=(['fake1', 'fake2', 'fake3'])))209 results = verify_tempest_config.verify_extensions(fake_os,210 'neutron', {})211 self.assertIn('neutron', results)212 self.assertIn('fake1', results['neutron'])213 self.assertTrue(results['neutron']['fake1'])214 self.assertIn('fake2', results['neutron'])215 self.assertTrue(results['neutron']['fake2'])216 self.assertIn('fake3', results['neutron'])217 self.assertFalse(results['neutron']['fake3'])218 self.assertIn('not_fake', results['neutron'])219 self.assertFalse(results['neutron']['not_fake'])220 def test_verify_extensions_neutron_all(self):221 def fake_list_extensions():222 return (None, {'extensions': [{'alias': 'fake1'},223 {'alias': 'fake2'},224 {'alias': 'not_fake'}]})225 fake_os = mock.MagicMock()226 fake_os.network_client.list_extensions = fake_list_extensions227 self.useFixture(mockpatch.PatchObject(228 verify_tempest_config, 'get_enabled_extensions',229 return_value=(['all'])))230 results = verify_tempest_config.verify_extensions(fake_os,231 'neutron', {})232 self.assertIn('neutron', results)233 self.assertIn('extensions', results['neutron'])234 self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),235 sorted(results['neutron']['extensions']))236 def test_verify_extensions_cinder(self):237 def fake_list_extensions():238 return (None, {'extensions': [{'name': 'fake1'},239 {'name': 'fake2'},240 {'name': 'not_fake'}]})241 fake_os = mock.MagicMock()242 fake_os.volumes_extension_client.list_extensions = fake_list_extensions243 self.useFixture(mockpatch.PatchObject(244 verify_tempest_config, 'get_enabled_extensions',245 return_value=(['fake1', 'fake2', 'fake3'])))246 results = verify_tempest_config.verify_extensions(fake_os,247 'cinder', {})248 self.assertIn('cinder', results)249 self.assertIn('fake1', results['cinder'])250 self.assertTrue(results['cinder']['fake1'])251 self.assertIn('fake2', results['cinder'])252 self.assertTrue(results['cinder']['fake2'])253 self.assertIn('fake3', results['cinder'])254 self.assertFalse(results['cinder']['fake3'])255 self.assertIn('not_fake', results['cinder'])256 self.assertFalse(results['cinder']['not_fake'])257 def test_verify_extensions_cinder_all(self):258 def fake_list_extensions():259 return (None, {'extensions': [{'name': 'fake1'},260 {'name': 'fake2'},261 {'name': 'not_fake'}]})262 fake_os = mock.MagicMock()263 fake_os.volumes_extension_client.list_extensions = fake_list_extensions264 self.useFixture(mockpatch.PatchObject(265 verify_tempest_config, 'get_enabled_extensions',266 return_value=(['all'])))267 results = verify_tempest_config.verify_extensions(fake_os,268 'cinder', {})269 self.assertIn('cinder', results)270 self.assertIn('extensions', results['cinder'])271 self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),272 sorted(results['cinder']['extensions']))273 def test_verify_extensions_nova(self):274 def fake_list_extensions():275 return (None, {'extensions': [{'alias': 'fake1'},276 {'alias': 'fake2'},277 {'alias': 'not_fake'}]})278 fake_os = mock.MagicMock()279 fake_os.extensions_client.list_extensions = fake_list_extensions280 self.useFixture(mockpatch.PatchObject(281 verify_tempest_config, 'get_enabled_extensions',282 return_value=(['fake1', 'fake2', 'fake3'])))283 results = verify_tempest_config.verify_extensions(fake_os,284 'nova', {})285 self.assertIn('nova', results)286 self.assertIn('fake1', results['nova'])287 self.assertTrue(results['nova']['fake1'])288 self.assertIn('fake2', results['nova'])289 self.assertTrue(results['nova']['fake2'])290 self.assertIn('fake3', results['nova'])291 self.assertFalse(results['nova']['fake3'])292 self.assertIn('not_fake', results['nova'])293 self.assertFalse(results['nova']['not_fake'])294 def test_verify_extensions_nova_all(self):295 def fake_list_extensions():296 return (None, {'extensions': [{'alias': 'fake1'},297 {'alias': 'fake2'},298 {'alias': 'not_fake'}]})299 fake_os = mock.MagicMock()300 fake_os.extensions_client.list_extensions = fake_list_extensions301 self.useFixture(mockpatch.PatchObject(302 verify_tempest_config, 'get_enabled_extensions',303 return_value=(['all'])))304 results = verify_tempest_config.verify_extensions(fake_os,305 'nova', {})306 self.assertIn('nova', results)307 self.assertIn('extensions', results['nova'])308 self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),309 sorted(results['nova']['extensions']))310 def test_verify_extensions_nova_v3(self):311 def fake_list_extensions():312 return (None, {'extensions': [{'alias': 'fake1'},313 {'alias': 'fake2'},314 {'alias': 'not_fake'}]})315 fake_os = mock.MagicMock()316 fake_os.extensions_v3_client.list_extensions = fake_list_extensions317 self.useFixture(mockpatch.PatchObject(318 verify_tempest_config, 'get_enabled_extensions',319 return_value=(['fake1', 'fake2', 'fake3'])))320 results = verify_tempest_config.verify_extensions(fake_os,321 'nova_v3', {})322 self.assertIn('nova_v3', results)323 self.assertIn('fake1', results['nova_v3'])324 self.assertTrue(results['nova_v3']['fake1'])325 self.assertIn('fake2', results['nova_v3'])326 self.assertTrue(results['nova_v3']['fake2'])327 self.assertIn('fake3', results['nova_v3'])328 self.assertFalse(results['nova_v3']['fake3'])329 self.assertIn('not_fake', results['nova_v3'])330 self.assertFalse(results['nova_v3']['not_fake'])331 def test_verify_extensions_nova_v3_all(self):332 def fake_list_extensions():333 return (None, {'extensions': [{'alias': 'fake1'},334 {'alias': 'fake2'},335 {'alias': 'not_fake'}]})336 fake_os = mock.MagicMock()337 fake_os.extensions_v3_client.list_extensions = fake_list_extensions338 self.useFixture(mockpatch.PatchObject(339 verify_tempest_config, 'get_enabled_extensions',340 return_value=(['all'])))341 results = verify_tempest_config.verify_extensions(fake_os,342 'nova_v3', {})343 self.assertIn('nova_v3', results)344 self.assertIn('extensions', results['nova_v3'])345 self.assertEqual(sorted(['fake1', 'fake2', 'not_fake']),346 sorted(results['nova_v3']['extensions']))347 def test_verify_extensions_swift(self):348 def fake_list_extensions():349 return (None, {'fake1': 'metadata',350 'fake2': 'metadata',351 'not_fake': 'metadata',352 'swift': 'metadata'})353 fake_os = mock.MagicMock()354 fake_os.account_client.list_extensions = fake_list_extensions355 self.useFixture(mockpatch.PatchObject(356 verify_tempest_config, 'get_enabled_extensions',357 return_value=(['fake1', 'fake2', 'fake3'])))358 results = verify_tempest_config.verify_extensions(fake_os, 'swift', {})359 self.assertIn('swift', results)360 self.assertIn('fake1', results['swift'])361 self.assertTrue(results['swift']['fake1'])362 self.assertIn('fake2', results['swift'])363 self.assertTrue(results['swift']['fake2'])364 self.assertIn('fake3', results['swift'])365 self.assertFalse(results['swift']['fake3'])366 self.assertIn('not_fake', results['swift'])367 self.assertFalse(results['swift']['not_fake'])368 def test_verify_extensions_swift_all(self):369 def fake_list_extensions():370 return (None, {'fake1': 'metadata',371 'fake2': 'metadata',372 'not_fake': 'metadata',373 'swift': 'metadata'})374 fake_os = mock.MagicMock()375 fake_os.account_client.list_extensions = fake_list_extensions376 self.useFixture(mockpatch.PatchObject(377 verify_tempest_config, 'get_enabled_extensions',378 return_value=(['all'])))379 results = verify_tempest_config.verify_extensions(fake_os,380 'swift', {})381 self.assertIn('swift', results)382 self.assertIn('extensions', results['swift'])383 self.assertEqual(sorted(['not_fake', 'fake1', 'fake2']),...
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!!