From 4852d4f0194a26b93cdeb48d4f3db666887524c5 Mon Sep 17 00:00:00 2001 From: Arkady Shtempler Date: Thu, 1 Apr 2021 15:02:31 +0300 Subject: [PATCH] Adding 4 "False Positive" test cases for a zone suite. 1) test_show_not_existing_zone - expected: "NotFound" 2) test_use_invalid_id_to_show_zone - expected: "BadRequest" 3) test_delete_non_existing_zone - expected: "NotFound" 4) test_update_non_existing_zone - expected: "NotFound" Change-Id: I0c6751add49b18ae0e4ab3c6e75d33ae12d09078 --- .../tests/api/v2/test_zones.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/designate_tempest_plugin/tests/api/v2/test_zones.py b/designate_tempest_plugin/tests/api/v2/test_zones.py index ee31b9b0..83ec020c 100644 --- a/designate_tempest_plugin/tests/api/v2/test_zones.py +++ b/designate_tempest_plugin/tests/api/v2/test_zones.py @@ -11,6 +11,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. +import uuid from oslo_log import log as logging from tempest.lib import decorators from tempest.lib import exceptions as lib_exc @@ -62,6 +63,18 @@ class ZonesTest(BaseZonesTest): LOG.info('Ensure the fetched response matches the created zone') self.assertExpected(zone, body, self.excluded_keys) + @decorators.idempotent_id('49268b24-92de-11eb-9d02-74e5f9e2a801') + def test_show_not_existing_zone(self): + LOG.info('Fetch non existing zone') + self.assertRaises(lib_exc.NotFound, + lambda: self.client.show_zone(uuid.uuid1())) + + @decorators.idempotent_id('736e3b50-92e0-11eb-9d02-74e5f9e2a801') + def test_use_invalid_id_to_show_zone(self): + LOG.info('Fetch the zone using invalid zone ID') + with self.assertRaisesDns(lib_exc.BadRequest, 'invalid_uuid', 400): + self.client.show_zone(uuid='zahlabut') + @decorators.attr(type='smoke') @decorators.idempotent_id('a4791906-6cd6-4d27-9f15-32273db8bb3d') def test_delete_zone(self): @@ -77,6 +90,12 @@ class ZonesTest(BaseZonesTest): self.assertEqual('DELETE', body['action']) self.assertEqual('PENDING', body['status']) + @decorators.idempotent_id('79921370-92e1-11eb-9d02-74e5f9e2a801') + def test_delete_non_existing_zone(self): + LOG.info('Delete non existing zone') + self.assertRaises(lib_exc.NotFound, + lambda: self.client.delete_zone(uuid.uuid1())) + @decorators.idempotent_id('5bfa3cfe-5bc8-443b-bf48-cfba44cbb247') def test_list_zones(self): LOG.info('Create a zone') @@ -110,6 +129,13 @@ class ZonesTest(BaseZonesTest): LOG.info('Ensure we respond with updated values') self.assertEqual(description, zone['description']) + @decorators.idempotent_id('e391e30a-92e0-11eb-9d02-74e5f9e2a801') + def test_update_non_existing_zone(self): + LOG.info('Update non existing zone') + self.assertRaises(lib_exc.NotFound, + lambda: self.client.update_zone( + uuid.uuid1(), description=data_utils.rand_name())) + @decorators.idempotent_id('925192f2-0ed8-4591-8fe7-a9fa028f90a0') def test_list_zones_dot_json_fails(self): uri = self.client.get_uri('zones.json')