From c705303457249e947055d5445295ba110cf3afd9 Mon Sep 17 00:00:00 2001 From: kasar Date: Thu, 3 Aug 2017 03:29:23 -0700 Subject: [PATCH] Added unit tests for delete_image specification Change-Id: I92a55269bad5edd39d9281d270e76f426002ccac Signed-off-by: kasar --- test/test_RO.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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): -- 2.25.1