Best Python code snippet using tempest_python
test_flavors_extra_specs.py
Source:test_flavors_extra_specs.py
...64 set_body = self.client.set_flavor_extra_spec(self.flavor['id'],65 **specs)['extra_specs']66 self.assertEqual(set_body, specs)67 # GET extra specs and verify68 get_body = (self.client.list_flavor_extra_specs(self.flavor['id'])69 ['extra_specs'])70 self.assertEqual(get_body, specs)71 # UPDATE the value of the extra specs key172 update_body = \73 self.client.update_flavor_extra_spec(self.flavor['id'],74 "key1",75 key1="value")76 self.assertEqual({"key1": "value"}, update_body)77 # GET extra specs and verify the value of the key278 # is the same as before79 get_body = (self.client.list_flavor_extra_specs(self.flavor['id'])80 ['extra_specs'])81 self.assertEqual(get_body, {"key1": "value", "key2": "value2"})82 # UNSET extra specs that were set in this test83 self.client.unset_flavor_extra_spec(self.flavor['id'], "key1")84 self.client.unset_flavor_extra_spec(self.flavor['id'], "key2")85 @test.idempotent_id('a99dad88-ae1c-4fba-aeb4-32f898218bd0')86 def test_flavor_non_admin_get_all_keys(self):87 specs = {"key1": "value1", "key2": "value2"}88 self.client.set_flavor_extra_spec(self.flavor['id'], **specs)89 body = (self.flavors_client.list_flavor_extra_specs(self.flavor['id'])90 ['extra_specs'])91 for key in specs:92 self.assertEqual(body[key], specs[key])93 @test.idempotent_id('12805a7f-39a3-4042-b989-701d5cad9c90')94 def test_flavor_non_admin_get_specific_key(self):95 body = self.client.set_flavor_extra_spec(self.flavor['id'],96 key1="value1",97 key2="value2")['extra_specs']98 self.assertEqual(body['key1'], 'value1')99 self.assertIn('key2', body)100 body = self.flavors_client.show_flavor_extra_spec(101 self.flavor['id'], 'key1')102 self.assertEqual(body['key1'], 'value1')103 self.assertNotIn('key2', body)
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!!