From 28af7412f80d973a2bf34130fc2926519861c06a Mon Sep 17 00:00:00 2001 From: Dick Marinus Date: Sun, 8 Mar 2020 20:56:21 +0100 Subject: [PATCH] Change RESTError to JsonRESTError for ImageNotFoundException, update test to expect ImageNotFoundException --- moto/ecr/exceptions.py | 4 ++-- tests/test_ecr/test_ecr_boto3.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/moto/ecr/exceptions.py b/moto/ecr/exceptions.py index 9b55f0589..6d1713a6a 100644 --- a/moto/ecr/exceptions.py +++ b/moto/ecr/exceptions.py @@ -1,5 +1,5 @@ from __future__ import unicode_literals -from moto.core.exceptions import RESTError +from moto.core.exceptions import RESTError, JsonRESTError class RepositoryNotFoundException(RESTError): @@ -13,7 +13,7 @@ class RepositoryNotFoundException(RESTError): ) -class ImageNotFoundException(RESTError): +class ImageNotFoundException(JsonRESTError): code = 400 def __init__(self, image_id, repository_name, registry_id): diff --git a/tests/test_ecr/test_ecr_boto3.py b/tests/test_ecr/test_ecr_boto3.py index 82a2c7521..6c6840a7e 100644 --- a/tests/test_ecr/test_ecr_boto3.py +++ b/tests/test_ecr/test_ecr_boto3.py @@ -538,7 +538,7 @@ def test_describe_image_that_doesnt_exist(): repositoryName="test_repository", imageIds=[{"imageTag": "testtag"}], registryId="123", - ).should.throw(ClientError, error_msg1) + ).should.throw(client.exceptions.ImageNotFoundException, error_msg1) error_msg2 = re.compile( r".*The repository with name 'repo-that-doesnt-exist' does not exist in the registry with id '123'.*",