Best Python code snippet using tempest_python
test_images_metadefs_namespace_tags.py
Source:test_images_metadefs_namespace_tags.py
...26 "name": "sample-tag3"27 }28 ]29 tag_list = ["sample-tag1", "sample-tag2", "sample-tag3"]30 def _create_namespace_tags(self, namespace):31 # Create a namespace32 namespace_tags = self.namespace_tags_client.create_namespace_tags(33 namespace['namespace'], tags=self.tags)34 self.addCleanup(test_utils.call_and_ignore_notfound_exc,35 self.namespace_tags_client.delete_namespace_tags,36 namespace['namespace'])37 return namespace_tags38 @decorators.idempotent_id('a2a3765e-3a6d-4f6d-a3a7-3cc3476aa876')39 def test_create_list_delete_namespace_tags(self):40 # Create a namespace41 namespace = self.create_namespace()42 self._create_namespace_tags(namespace)43 # List namespace tags44 body = self.namespace_tags_client.list_namespace_tags(45 namespace['namespace'])46 self.assertTrue(3, len(body['tags']))47 self.assertIn(body['tags'][0]['name'], self.tag_list)48 self.assertIn(body['tags'][1]['name'], self.tag_list)49 self.assertIn(body['tags'][2]['name'], self.tag_list)50 # Delete all tag definitions51 self.namespace_tags_client.delete_namespace_tags(52 namespace['namespace'])53 body = self.namespace_tags_client.list_namespace_tags(54 namespace['namespace'])55 self.assertEqual([], body['tags'])56 @decorators.idempotent_id('a2a3765e-1a2c-3f6d-a3a7-3cc3466ab875')57 def test_create_update_delete_tag(self):58 # Create a namespace59 namespace = self.create_namespace()60 self._create_namespace_tags(namespace)61 # Create a tag62 tag_name = data_utils.rand_name('tag_name')63 self.namespace_tags_client.create_namespace_tag(64 namespace=namespace['namespace'], tag_name=tag_name)65 body = self.namespace_tags_client.show_namespace_tag(66 namespace['namespace'], tag_name)67 self.assertEqual(tag_name, body['name'])68 # Update tag definition69 update_tag_definition = data_utils.rand_name('update-tag')70 body = self.namespace_tags_client.update_namespace_tag(71 namespace['namespace'], tag_name=tag_name,72 name=update_tag_definition)73 self.assertEqual(update_tag_definition, body['name'])74 # Delete tag definition...
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!!