From: kasar Date: Thu, 3 Aug 2017 10:29:23 +0000 (-0700) Subject: Added unit tests for delete_image specification X-Git-Tag: v3.0.0~17^2~11 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F62%2F2062%2F2;p=osm%2FRO.git Added unit tests for delete_image specification Change-Id: I92a55269bad5edd39d9281d270e76f426002ccac Signed-off-by: kasar --- diff --git a/test/test_RO.py b/test/test_RO.py index 38098ff0..5b47182d 100755 --- a/test/test_RO.py +++ b/test/test_RO.py @@ -823,6 +823,7 @@ class test_vimconn_new_image(test_base): image_path = test_config['image_path'] if image_path: image_id = test_config["vim_conn"].new_image({ 'name': 'TestImage', 'location' : image_path }) + time.sleep(20) self.assertEqual(type(image_id),str) self.assertIsInstance(uuid.UUID(image_id),uuid.UUID) else: @@ -841,6 +842,28 @@ class test_vimconn_new_image(test_base): self.assertEqual((context.exception).http_code, 400) + def test_020_delete_image(self): + self.__class__.test_text = "{}.{}. TEST {}".format(test_config["test_number"], + self.__class__.test_index, + inspect.currentframe().f_code.co_name) + self.__class__.test_index += 1 + + image_id = test_config["vim_conn"].delete_image(self.__class__.image_id) + self.assertEqual(type(image_id),str) + + def test_030_delete_image_negative(self): + Non_exist_image_id = str(uuid.uuid4()) + + self.__class__.test_text = "{}.{}. TEST {}".format(test_config["test_number"], + self.__class__.test_index, + inspect.currentframe().f_code.co_name) + self.__class__.test_index += 1 + + with self.assertRaises(Exception) as context: + test_config["vim_conn"].delete_image(Non_exist_image_id) + + self.assertEqual((context.exception).http_code, 404) + class test_vimconn_get_image_id_from_path(test_base): def test_000_get_image_id_from_path(self):