diff --git a/application_manager/__pycache__/app_dht.cpython-310.pyc b/application_manager/__pycache__/app_dht.cpython-310.pyc index 3ad3785..20e83fd 100644 Binary files a/application_manager/__pycache__/app_dht.cpython-310.pyc and b/application_manager/__pycache__/app_dht.cpython-310.pyc differ diff --git a/application_manager/app_dht.py b/application_manager/app_dht.py index a14e95e..00c9ab5 100644 --- a/application_manager/app_dht.py +++ b/application_manager/app_dht.py @@ -57,6 +57,8 @@ def update_dht_list(ws, image_name): def pull_image(ws, image_name, topic_uuid, requestor_id, request_id): + if image_name == "": + raise ValueError("Image name cannot be empty") if image_name: try: client.images.pull(image_name) diff --git a/tests/__pycache__/test_application_manager.cpython-310-pytest-7.4.0.pyc b/tests/__pycache__/test_application_manager.cpython-310-pytest-7.4.0.pyc index b46eee5..c61f91e 100644 Binary files a/tests/__pycache__/test_application_manager.cpython-310-pytest-7.4.0.pyc and b/tests/__pycache__/test_application_manager.cpython-310-pytest-7.4.0.pyc differ diff --git a/tests/test_application_manager.py b/tests/test_application_manager.py index 1ff0b6c..8d5164d 100644 --- a/tests/test_application_manager.py +++ b/tests/test_application_manager.py @@ -74,17 +74,14 @@ def test_publish_failure(self): ws, topic_uuid, requestor_id, request_id, containers ) - def test_pull_image_invalid_image_name(self): - """Test the pull_image function with an invalid image name.""" + def test_pull_image_empty_image_name(self): + """Test the pull_image function with an empty image name.""" ws = mock.Mock() - image_name = "invalid_image_name" + image_name = "" # Call the pull_image function. - response = app_dht.pull_image(ws, image_name, "1", "1", "1") - - # Assert that the response is not successful. - self.assertEqual(response[0], "Image not found") - self.assertEqual(response[1], 404) + with self.assertRaises(ValueError): + app_dht.pull_image(ws, image_name, "1", "1", "1") if __name__ == "__main__":