Best Python code snippet using tempest_python
test_server_tags.py
Source:test_server_tags.py
...40 for tag in tags:41 self.client.update_tag(server_id, tag)42 self.addCleanup(self.client.delete_all_tags, server_id)43 @decorators.idempotent_id('8d95abe2-c658-4c42-9a44-c0258500306b')44 def test_create_delete_tag(self):45 # Check that no tags exist.46 fetched_tags = self.client.list_tags(self.server['id'])['tags']47 self.assertEmpty(fetched_tags)48 # Add server tag to the server.49 assigned_tag = data_utils.rand_name('tag')50 self._update_server_tags(self.server['id'], assigned_tag)51 # Check that added tag exists.52 fetched_tags = self.client.list_tags(self.server['id'])['tags']53 self.assertEqual([assigned_tag], fetched_tags)54 # Remove assigned tag from server and check that it was removed.55 self.client.delete_tag(self.server['id'], assigned_tag)56 fetched_tags = self.client.list_tags(self.server['id'])['tags']57 self.assertEmpty(fetched_tags)58 @decorators.idempotent_id('a2c1af8c-127d-417d-974b-8115f7e3d831')...
tests.py
Source:tests.py
...21 assert request.status_code == 20022 request_delete = requests.delete("http://127.0.0.1:8000/api/v1/clients/8/delete_tags/", json=payload)23 request_delete_body = request_delete.json()24 assert request.status_code == 20025def test_create_delete_tag():26 """27 Request for create and delete tag28 """29 payload = {30 "field": 3,31 "title": "footbal"32 }33 request = requests.post("http://127.0.0.1:8000/api/v1/tags/", json=payload)34 request_body = request.json()35 pk = request_body["id"]36 assert request.status_code == 20137 assert request_body["title"] == "footbal"38 assert request_body["field"] == 339 request_delete = requests.delete(f"http://127.0.0.1:8000/api/v1/tags/{pk}/")...
plexdb_test.py
Source:plexdb_test.py
...5 def setUp(self):6 self.db = plexdb.PlexDB('/opt/tmp/test.db')7 self.file = \8 '/mnt/multimedia/NEW/Foto/2019/2019-11-05/2019-11-05_18-19-12.JPG'9 def test_create_delete_tag(self):10 self.db.create_tag('TestPlexDB_test_tag', plexdb.TAG_TYPE_PHOTO)11 self.assertEqual(1, self.db.delete_tag('TestPlexDB_test_tag',12 plexdb.TAG_TYPE_PHOTO))13 def test_create_delete_tags(self):14 self.db.create_tag('TestPlexDB_test_tag1', plexdb.TAG_TYPE_PHOTO)15 self.db.create_tag('TestPlexDB_test_tag2', plexdb.TAG_TYPE_PHOTO)16 self.db.create_tag('TestPlexDB_test_tag3', plexdb.TAG_TYPE_PHOTO)17 self.db.create_tag('TestPlexDB_test_tag4', plexdb.TAG_TYPE_VIDEO)18 self.db.create_tag('TestPlexDB_test_tag5', plexdb.TAG_TYPE_VIDEO)19 self.assertEqual(5, self.db.delete_tags('TestPlexDB_test_tag'))20 def test_delete_unexists_tag(self):21 self.assertEqual(0, self.db.delete_tag('TestPlexDB_test_tag_unexists',22 plexdb.TAG_TYPE_VIDEO))23 def test_set_clean_tags(self):...
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!!