Repository: getmoto/moto
Pull request #6999 (2023-11-07 11:18:23)

ECR: image digest fix
Resolves https://github.com/getmoto/moto/issues/6997

codecov[bot]: ## [Codecov](https://app.codecov.io/gh/getmoto/moto/pull/6999?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) Report
> Merging [#6999](https://app.codecov.io/gh/getmoto/moto/pull/6999?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) (99e0433) into [master](https://app.codecov.io/gh/getmoto/moto/commit/6e9960895e9e3f522e4e52695bb5899920ce7a84?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) (6e99608) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##           master    #6999   +/-   ##
=======================================
  Coverage   95.84%   95.84%           
=======================================
  Files         834      834           
  Lines       81460    81461    +1     
=======================================
+ Hits        78072    78073    +1     
  Misses       3388     3388           
```

| [Flag](https://app.codecov.io/gh/getmoto/moto/pull/6999/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) | Coverage Δ | |
|---|---|---|
| [servertests](https://app.codecov.io/gh/getmoto/moto/pull/6999/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) | `36.66% <0.00%> (-0.01%)` | :arrow_down: |
| [unittests](https://app.codecov.io/gh/getmoto/moto/pull/6999/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) | `95.78% <100.00%> (+<0.01%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Files](https://app.codecov.io/gh/getmoto/moto/pull/6999?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto) | Coverage Δ | |
|---|---|---|
| [moto/ecr/models.py](https://app.codecov.io/gh/getmoto/moto/pull/6999?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto#diff-bW90by9lY3IvbW9kZWxzLnB5) | `96.03% <ø> (ø)` | |
| [moto/ecr/responses.py](https://app.codecov.io/gh/getmoto/moto/pull/6999?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=getmoto#diff-bW90by9lY3IvcmVzcG9uc2VzLnB5) | `96.93% <100.00%> (+0.01%)` | :arrow_up: |



Patch:
diff --git a/moto/ecr/models.py b/moto/ecr/models.py
index b91465524..90ed7b28d 100644
--- a/moto/ecr/models.py
+++ b/moto/ecr/models.py
@@ -560,6 +560,7 @@ class ECRBackend(BaseBackend):
         image_manifest: str,
         image_tag: str,
         image_manifest_mediatype: Optional[str] = None,
+        digest: Optional[str] = None,
     ) -> Image:
         if repository_name in self.repositories:
             repository = self.repositories[repository_name]
@@ -612,6 +613,7 @@ class ECRBackend(BaseBackend):
                 image_manifest,
                 repository_name,
                 image_manifest_mediatype,
+                digest,
             )
             repository.images.append(image)
             if existing_images_with_matching_tag:
diff --git a/moto/ecr/responses.py b/moto/ecr/responses.py
index abcd315a5..68b806c8c 100644
--- a/moto/ecr/responses.py
+++ b/moto/ecr/responses.py
@@ -57,8 +57,9 @@ class ECRResponse(BaseResponse):
         image_manifest = self._get_param("imageManifest")
         image_tag = self._get_param("imageTag")
         image_manifest_media_type = self._get_param("imageManifestMediaType")
+        digest = self._get_param("imageDigest")
         image = self.ecr_backend.put_image(
-            repository_str, image_manifest, image_tag, image_manifest_media_type
+            repository_str, image_manifest, image_tag, image_manifest_media_type, digest
         )
 
         return json.dumps({"image": image.response_object})


Test patch:
diff --git a/tests/test_ecr/test_ecr_boto3.py b/tests/test_ecr/test_ecr_boto3.py
index a88f52c25..ac5464568 100644
--- a/tests/test_ecr/test_ecr_boto3.py
+++ b/tests/test_ecr/test_ecr_boto3.py
@@ -13,27 +13,30 @@ from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
 
 from .test_ecr_helpers import _create_image_manifest, _create_image_manifest_list
 
+ECR_REGION = "us-east-1"
+ECR_REPO = "test-repo"
+ECR_REPO_NOT_EXIST = "does-not-exist"
+
 
 @mock_ecr
 def test_create_repository():
     # given
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "test-repo"
+    client = boto3.client("ecr", region_name=ECR_REGION)
 
     # when
-    response = client.create_repository(repositoryName=repo_name)
+    response = client.create_repository(repositoryName=ECR_REPO)
 
     # then
     repo = response["repository"]
-    assert repo["repositoryName"] == repo_name
+    assert repo["repositoryName"] == ECR_REPO
     assert (
         repo["repositoryArn"]
-        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{repo_name}"
+        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{ECR_REPO}"
     )
     assert repo["registryId"] == ACCOUNT_ID
     assert (
         repo["repositoryUri"]
-        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{repo_name}"
+        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{ECR_REPO}"
     )
     assert isinstance(repo["createdAt"], datetime)
     assert repo["imageTagMutability"] == "MUTABLE"
@@ -46,12 +49,11 @@ def test_create_repository_with_non_default_config():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
     kms_key = f"arn:aws:kms:{region_name}:{ACCOUNT_ID}:key/51d81fab-b138-4bd2-8a09-07fd6d37224d"
 
     # when
     response = client.create_repository(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageTagMutability="IMMUTABLE",
         imageScanningConfiguration={"scanOnPush": True},
         encryptionConfiguration={"encryptionType": "KMS", "kmsKey": kms_key},
@@ -60,15 +62,15 @@ def test_create_repository_with_non_default_config():
 
     # then
     repo = response["repository"]
-    assert repo["repositoryName"] == repo_name
+    assert repo["repositoryName"] == ECR_REPO
     assert (
         repo["repositoryArn"]
-        == f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{repo_name}"
+        == f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{ECR_REPO}"
     )
     assert repo["registryId"] == ACCOUNT_ID
     assert (
         repo["repositoryUri"]
-        == f"{ACCOUNT_ID}.dkr.ecr.{region_name}.amazonaws.com/{repo_name}"
+        == f"{ACCOUNT_ID}.dkr.ecr.{region_name}.amazonaws.com/{ECR_REPO}"
     )
     assert isinstance(repo["createdAt"], datetime)
     assert repo["imageTagMutability"] == "IMMUTABLE"
@@ -82,12 +84,11 @@ def test_create_repository_with_non_default_config():
 @mock_ecr
 def test_create_repository_in_different_account():
     # given
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "test-repo"
+    client = boto3.client("ecr", region_name=ECR_REGION)
 
     # when passing in a custom registry ID
     response = client.create_repository(
-        registryId="222222222222", repositoryName=repo_name
+        registryId="222222222222", repositoryName=ECR_REPO
     )
 
     # then we should persist this ID
@@ -116,15 +117,14 @@ def test_create_repository_with_aws_managed_kms():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
 
     # when
     repo = client.create_repository(
-        repositoryName=repo_name, encryptionConfiguration={"encryptionType": "KMS"}
+        repositoryName=ECR_REPO, encryptionConfiguration={"encryptionType": "KMS"}
     )["repository"]
 
     # then
-    assert repo["repositoryName"] == repo_name
+    assert repo["repositoryName"] == ECR_REPO
     assert repo["encryptionConfiguration"]["encryptionType"] == "KMS"
     assert repo["encryptionConfiguration"]["kmsKey"].startswith(
         f"arn:aws:kms:eu-central-1:{ACCOUNT_ID}:key/"
@@ -134,13 +134,12 @@ def test_create_repository_with_aws_managed_kms():
 @mock_ecr
 def test_create_repository_error_already_exists():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # when
     with pytest.raises(ClientError) as e:
-        client.create_repository(repositoryName=repo_name)
+        client.create_repository(repositoryName=ECR_REPO)
 
     # then
     ex = e.value
@@ -149,13 +148,13 @@ def test_create_repository_error_already_exists():
     assert ex.response["Error"]["Code"] == "RepositoryAlreadyExistsException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' already exists in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO}' already exists in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_create_repository_error_name_validation():
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     repo_name = "tesT"
 
     with pytest.raises(ClientError) as e:
@@ -168,7 +167,7 @@ def test_create_repository_error_name_validation():
 
 @mock_ecr
 def test_describe_repositories():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository1")
     _ = client.create_repository(repositoryName="test_repository0")
     response = client.describe_repositories()
@@ -195,7 +194,7 @@ def test_describe_repositories():
 
 @mock_ecr
 def test_describe_repositories_1():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository1")
     _ = client.create_repository(repositoryName="test_repository0")
     response = client.describe_repositories(registryId=ACCOUNT_ID)
@@ -222,7 +221,7 @@ def test_describe_repositories_1():
 
 @mock_ecr
 def test_describe_repositories_2():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository1")
     _ = client.create_repository(repositoryName="test_repository0")
     response = client.describe_repositories(registryId="109876543210")
@@ -231,7 +230,7 @@ def test_describe_repositories_2():
 
 @mock_ecr
 def test_describe_repositories_3():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository1")
     _ = client.create_repository(repositoryName="test_repository0")
     response = client.describe_repositories(repositoryNames=["test_repository1"])
@@ -246,17 +245,16 @@ def test_describe_repositories_3():
 @mock_ecr
 def test_describe_repositories_with_image():
     # given
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag="latest",
     )
 
     # when
-    response = client.describe_repositories(repositoryNames=[repo_name])
+    response = client.describe_repositories(repositoryNames=[ECR_REPO])
 
     # then
     assert len(response["repositories"]) == 1
@@ -265,12 +263,12 @@ def test_describe_repositories_with_image():
     assert repo["registryId"] == ACCOUNT_ID
     assert (
         repo["repositoryArn"]
-        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{repo_name}"
+        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{ECR_REPO}"
     )
-    assert repo["repositoryName"] == repo_name
+    assert repo["repositoryName"] == ECR_REPO
     assert (
         repo["repositoryUri"]
-        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{repo_name}"
+        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{ECR_REPO}"
     )
     assert isinstance(repo["createdAt"], datetime)
     assert repo["imageScanningConfiguration"] == {"scanOnPush": False}
@@ -281,24 +279,23 @@ def test_describe_repositories_with_image():
 @mock_ecr
 def test_delete_repository():
     # given
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # when
-    response = client.delete_repository(repositoryName=repo_name)
+    response = client.delete_repository(repositoryName=ECR_REPO)
 
     # then
     repo = response["repository"]
-    assert repo["repositoryName"] == repo_name
+    assert repo["repositoryName"] == ECR_REPO
     assert (
         repo["repositoryArn"]
-        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{repo_name}"
+        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{ECR_REPO}"
     )
     assert repo["registryId"] == ACCOUNT_ID
     assert (
         repo["repositoryUri"]
-        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{repo_name}"
+        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{ECR_REPO}"
     )
     assert isinstance(repo["createdAt"], datetime)
     assert repo["imageTagMutability"] == "MUTABLE"
@@ -309,30 +306,29 @@ def test_delete_repository():
 
 @mock_ecr
 def test_delete_repository_with_force():
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag="latest",
     )
 
     # when
     # when
-    response = client.delete_repository(repositoryName=repo_name, force=True)
+    response = client.delete_repository(repositoryName=ECR_REPO, force=True)
 
     # then
     repo = response["repository"]
-    assert repo["repositoryName"] == repo_name
+    assert repo["repositoryName"] == ECR_REPO
     assert (
         repo["repositoryArn"]
-        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{repo_name}"
+        == f"arn:aws:ecr:us-east-1:{ACCOUNT_ID}:repository/{ECR_REPO}"
     )
     assert repo["registryId"] == ACCOUNT_ID
     assert (
         repo["repositoryUri"]
-        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{repo_name}"
+        == f"{ACCOUNT_ID}.dkr.ecr.us-east-1.amazonaws.com/{ECR_REPO}"
     )
     assert isinstance(repo["createdAt"], datetime)
     assert repo["imageTagMutability"] == "MUTABLE"
@@ -343,7 +339,7 @@ def test_delete_repository_with_force():
 
 @mock_ecr
 def test_put_image():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     response = client.put_image(
@@ -360,7 +356,7 @@ def test_put_image():
 
 @mock_ecr
 def test_put_image_without_mediatype():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     image_manifest = _create_image_manifest()
@@ -376,7 +372,7 @@ def test_put_image_without_mediatype():
 
 @mock_ecr
 def test_put_image_with_imagemanifestmediatype():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     image_manifest = _create_image_manifest()
@@ -398,7 +394,7 @@ def test_put_image_with_imagemanifestmediatype():
 
 @mock_ecr()
 def test_put_manifest_list():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     manifest_list = _create_image_manifest_list()
@@ -429,7 +425,7 @@ def test_put_image_with_push_date():
     if settings.TEST_SERVER_MODE:
         raise SkipTest("Cant manipulate time in server mode")
 
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     with freeze_time("2018-08-28 00:00:00"):
@@ -461,7 +457,7 @@ def test_put_image_with_push_date():
 
 @mock_ecr
 def test_put_image_with_multiple_tags():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
     manifest = _create_image_manifest()
     response = client.put_image(
@@ -501,15 +497,14 @@ def test_put_image_with_multiple_tags():
 
 @mock_ecr
 def test_put_multiple_images_with_same_tag():
-    repo_name = "testrepo"
     image_tag = "my-tag"
     manifest = json.dumps(_create_image_manifest())
 
     client = boto3.client("ecr", "us-east-1")
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     image_1 = client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageTag=image_tag,
         imageManifest=manifest,
     )["image"]["imageId"]["imageDigest"]
@@ -518,48 +513,47 @@ def test_put_multiple_images_with_same_tag():
     # only has one tag
 
     image_2 = client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageTag=image_tag,
         imageManifest=json.dumps(_create_image_manifest()),
     )["image"]["imageId"]["imageDigest"]
 
     assert image_1 != image_2
 
-    images = client.describe_images(repositoryName=repo_name)["imageDetails"]
+    images = client.describe_images(repositoryName=ECR_REPO)["imageDetails"]
 
     assert len(images) == 1
     assert images[0]["imageDigest"] == image_2
 
     # Same image with different tags is allowed
     image_3 = client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageTag="different-tag",
         imageManifest=manifest,
     )["image"]["imageId"]["imageDigest"]
 
-    images = client.describe_images(repositoryName=repo_name)["imageDetails"]
+    images = client.describe_images(repositoryName=ECR_REPO)["imageDetails"]
     assert len(images) == 2
     assert set([img["imageDigest"] for img in images]) == {image_2, image_3}
 
 
 @mock_ecr
 def test_put_same_image_with_same_tag():
-    repo_name = "testrepo"
     image_tag = "my-tag"
     manifest = json.dumps(_create_image_manifest())
 
     client = boto3.client("ecr", "us-east-1")
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     image_1 = client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageTag=image_tag,
         imageManifest=manifest,
     )["image"]["imageId"]["imageDigest"]
 
     with pytest.raises(ClientError) as e:
         client.put_image(
-            repositoryName=repo_name,
+            repositoryName=ECR_REPO,
             imageTag=image_tag,
             imageManifest=manifest,
         )["image"]["imageId"]["imageDigest"]
@@ -570,17 +564,16 @@ def test_put_same_image_with_same_tag():
     assert "ImageAlreadyExistsException" in ex.response["Error"]["Code"]
     assert (
         ex.response["Error"]["Message"]
-        == f"Image with digest '{image_1}' and tag '{image_tag}' already exists in the repository with name '{repo_name}' in registry with id '{ACCOUNT_ID}'"
+        == f"Image with digest '{image_1}' and tag '{image_tag}' already exists in the repository with name '{ECR_REPO}' in registry with id '{ACCOUNT_ID}'"
     )
 
-    images = client.describe_images(repositoryName=repo_name)["imageDetails"]
+    images = client.describe_images(repositoryName=ECR_REPO)["imageDetails"]
 
     assert len(images) == 1
 
 
 @mock_ecr
 def test_multiple_tags__ensure_tags_exist_only_on_one_image():
-    repo_name = "testrepo"
     tag_to_move = "mock-tag"
     image_manifests = {
         "image_001": json.dumps(_create_image_manifest()),
@@ -588,40 +581,40 @@ def test_multiple_tags__ensure_tags_exist_only_on_one_image():
     }
 
     client = boto3.client("ecr", "us-east-1")
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # Create image with unique tag
     for name, manifest in image_manifests.items():
         client.put_image(
-            repositoryName=repo_name,
+            repositoryName=ECR_REPO,
             imageTag=name,
             imageManifest=manifest,
         )
 
     # Tag first image with shared tag
     client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageTag=tag_to_move,
         imageManifest=image_manifests["image_001"],
     )["image"]["imageId"]["imageDigest"]
 
     # Image can be found
     initial_image, *_ = client.batch_get_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageIds=[{"imageTag": tag_to_move}],
     )["images"]
     assert initial_image["imageManifest"] == image_manifests["image_001"]
 
     # Tag second image with shared tag
     client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageTag=tag_to_move,
         imageManifest=image_manifests["image_002"],
     )["image"]["imageId"]["imageDigest"]
 
     # We should find the second image now - the shared tag should be removed from the first image
     new_image, *_ = client.batch_get_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageIds=[{"imageTag": tag_to_move}],
     )["images"]
     assert new_image["imageManifest"] == image_manifests["image_002"]
@@ -629,7 +622,7 @@ def test_multiple_tags__ensure_tags_exist_only_on_one_image():
 
 @mock_ecr
 def test_list_images():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository_1")
 
     _ = client.create_repository(repositoryName="test_repository_2")
@@ -681,7 +674,7 @@ def test_list_images():
 
 @mock_ecr
 def test_list_images_from_repository_that_doesnt_exist():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository_1")
 
     # non existing repo
@@ -699,7 +692,7 @@ def test_list_images_from_repository_that_doesnt_exist():
 
 @mock_ecr
 def test_describe_images():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     _ = client.put_image(
@@ -776,7 +769,7 @@ def test_describe_images():
 
 @mock_ecr
 def test_describe_images_by_tag():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     tag_map = {}
@@ -802,7 +795,7 @@ def test_describe_images_by_tag():
 
 @mock_ecr
 def test_describe_images_tags_should_not_contain_empty_tag1():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -829,7 +822,7 @@ def test_describe_images_tags_should_not_contain_empty_tag1():
 
 @mock_ecr
 def test_describe_images_tags_should_not_contain_empty_tag2():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -862,7 +855,7 @@ def test_describe_images_tags_should_not_contain_empty_tag2():
 
 @mock_ecr
 def test_describe_repository_that_doesnt_exist():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
 
     with pytest.raises(ClientError) as exc:
         client.describe_repositories(
@@ -874,7 +867,7 @@ def test_describe_repository_that_doesnt_exist():
 
 @mock_ecr
 def test_describe_image_that_doesnt_exist():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     with pytest.raises(ClientError) as exc:
@@ -898,12 +891,11 @@ def test_describe_image_that_doesnt_exist():
 
 @mock_ecr
 def test_delete_repository_that_doesnt_exist():
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "repo-that-doesnt-exist"
+    client = boto3.client("ecr", region_name=ECR_REGION)
 
     # when
     with pytest.raises(ClientError) as e:
-        client.delete_repository(repositoryName=repo_name)
+        client.delete_repository(repositoryName=ECR_REPO_NOT_EXIST)
 
     # then
     ex = e.value
@@ -912,24 +904,23 @@ def test_delete_repository_that_doesnt_exist():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_delete_repository_error_not_empty():
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag="latest",
     )
 
     # when
     with pytest.raises(ClientError) as e:
-        client.delete_repository(repositoryName=repo_name)
+        client.delete_repository(repositoryName=ECR_REPO)
 
     # then
     ex = e.value
@@ -938,13 +929,13 @@ def test_delete_repository_error_not_empty():
     assert ex.response["Error"]["Code"] == "RepositoryNotEmptyException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' in registry with id '{ACCOUNT_ID}' cannot be deleted because it still contains images"
+        == f"The repository with name '{ECR_REPO}' in registry with id '{ACCOUNT_ID}' cannot be deleted because it still contains images"
     )
 
 
 @mock_ecr
 def test_describe_images_by_digest():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     tags = ["latest", "v1", "v2"]
@@ -973,7 +964,7 @@ def test_describe_images_by_digest():
 
 @mock_ecr
 def test_get_authorization_token_assume_region():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     auth_token_response = client.get_authorization_token()
 
     assert "authorizationData" in auth_token_response
@@ -989,7 +980,7 @@ def test_get_authorization_token_assume_region():
 
 @mock_ecr
 def test_get_authorization_token_explicit_regions():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     auth_token_response = client.get_authorization_token(
         registryIds=["10987654321", "878787878787"]
     )
@@ -1012,7 +1003,7 @@ def test_get_authorization_token_explicit_regions():
 
 @mock_ecr
 def test_batch_get_image():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     _ = client.put_image(
@@ -1056,7 +1047,7 @@ def test_batch_get_image():
 
 @mock_ecr
 def test_batch_get_image_that_doesnt_exist():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     _ = client.put_image(
@@ -1093,7 +1084,7 @@ def test_batch_get_image_that_doesnt_exist():
 
 @mock_ecr
 def test_batch_get_image_with_multiple_tags():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     _ = client.create_repository(repositoryName="test_repository")
 
     manifest = json.dumps(_create_image_manifest())
@@ -1125,7 +1116,7 @@ def test_batch_get_image_with_multiple_tags():
 
 @mock_ecr
 def test_batch_delete_image_by_tag():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -1165,7 +1156,7 @@ def test_batch_delete_image_by_tag():
 
 @mock_ecr
 def test_batch_delete_image_delete_last_tag():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     client.put_image(
@@ -1201,7 +1192,7 @@ def test_batch_delete_image_delete_last_tag():
 
 @mock_ecr
 def test_batch_delete_image_with_nonexistent_tag():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -1242,7 +1233,7 @@ def test_batch_delete_image_with_nonexistent_tag():
 
 @mock_ecr
 def test_batch_delete_image_by_digest():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -1288,7 +1279,7 @@ def test_batch_delete_image_by_digest():
 
 @mock_ecr
 def test_batch_delete_image_with_invalid_digest():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -1328,7 +1319,7 @@ def test_batch_delete_image_with_invalid_digest():
 
 @mock_ecr
 def test_batch_delete_image_with_missing_parameters():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     batch_delete_response = client.batch_delete_image(
@@ -1350,7 +1341,7 @@ def test_batch_delete_image_with_missing_parameters():
 
 @mock_ecr
 def test_batch_delete_image_with_matching_digest_and_tag():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -1396,7 +1387,7 @@ def test_batch_delete_image_with_matching_digest_and_tag():
 
 @mock_ecr
 def test_batch_delete_image_with_mismatched_digest_and_tag():
-    client = boto3.client("ecr", region_name="us-east-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     client.create_repository(repositoryName="test_repository")
 
     manifest = _create_image_manifest()
@@ -1437,20 +1428,19 @@ def test_batch_delete_image_with_mismatched_digest_and_tag():
 
 @mock_ecr
 def test_delete_batch_image_with_multiple_images():
-    client = boto3.client("ecr", region_name="us-east-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # Populate mock repo with images
     for i in range(10):
         client.put_image(
-            repositoryName=repo_name,
+            repositoryName=ECR_REPO,
             imageManifest=json.dumps(_create_image_manifest()),
             imageTag=f"tag{i}",
         )
 
     # Pull down image digests for each image in the mock repo
-    repo_images = client.describe_images(repositoryName=repo_name)["imageDetails"]
+    repo_images = client.describe_images(repositoryName=ECR_REPO)["imageDetails"]
     image_digests = [{"imageDigest": image["imageDigest"]} for image in repo_images]
 
     # Pick a couple of images to delete
@@ -1458,13 +1448,13 @@ def test_delete_batch_image_with_multiple_images():
 
     # Delete the images
     response = client.batch_delete_image(
-        repositoryName=repo_name, imageIds=images_to_delete
+        repositoryName=ECR_REPO, imageIds=images_to_delete
     )
     assert len(response["imageIds"]) == 2
     assert response["failures"] == []
 
     # Verify other images still exist
-    repo_images = client.describe_images(repositoryName=repo_name)["imageDetails"]
+    repo_images = client.describe_images(repositoryName=ECR_REPO)["imageDetails"]
     image_tags = [img["imageTags"][0] for img in repo_images]
     assert image_tags == [
         "tag0",
@@ -1481,10 +1471,9 @@ def test_delete_batch_image_with_multiple_images():
 @mock_ecr
 def test_list_tags_for_resource():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
+    client = boto3.client("ecr", region_name=ECR_REGION)
     arn = client.create_repository(
-        repositoryName=repo_name, tags=[{"Key": "key-1", "Value": "value-1"}]
+        repositoryName=ECR_REPO, tags=[{"Key": "key-1", "Value": "value-1"}]
     )["repository"]["repositoryArn"]
 
     # when
@@ -1499,12 +1488,11 @@ def test_list_tags_for_resource_error_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.list_tags_for_resource(
-            resourceArn=f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{repo_name}"
+            resourceArn=f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{ECR_REPO}"
         )
 
     # then
@@ -1514,7 +1502,7 @@ def test_list_tags_for_resource_error_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -1542,10 +1530,9 @@ def test_list_tags_for_resource_error_invalid_param():
 @mock_ecr
 def test_tag_resource():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
+    client = boto3.client("ecr", region_name=ECR_REGION)
     arn = client.create_repository(
-        repositoryName=repo_name, tags=[{"Key": "key-1", "Value": "value-1"}]
+        repositoryName=ECR_REPO, tags=[{"Key": "key-1", "Value": "value-1"}]
     )["repository"]["repositoryArn"]
 
     # when
@@ -1564,12 +1551,11 @@ def test_tag_resource_error_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.tag_resource(
-            resourceArn=f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{repo_name}",
+            resourceArn=f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{ECR_REPO}",
             tags=[{"Key": "key-1", "Value": "value-2"}],
         )
 
@@ -1580,17 +1566,16 @@ def test_tag_resource_error_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_untag_resource():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
+    client = boto3.client("ecr", region_name=ECR_REGION)
     arn = client.create_repository(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         tags=[
             {"Key": "key-1", "Value": "value-1"},
             {"Key": "key-2", "Value": "value-2"},
@@ -1610,12 +1595,11 @@ def test_untag_resource_error_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.untag_resource(
-            resourceArn=f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{repo_name}",
+            resourceArn=f"arn:aws:ecr:{region_name}:{ACCOUNT_ID}:repository/{ECR_REPO}",
             tagKeys=["key-1"],
         )
 
@@ -1626,31 +1610,30 @@ def test_untag_resource_error_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_put_image_tag_mutability():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
 
-    response = client.describe_repositories(repositoryNames=[repo_name])
+    response = client.describe_repositories(repositoryNames=[ECR_REPO])
     assert response["repositories"][0]["imageTagMutability"] == "MUTABLE"
 
     # when
     response = client.put_image_tag_mutability(
-        repositoryName=repo_name, imageTagMutability="IMMUTABLE"
+        repositoryName=ECR_REPO, imageTagMutability="IMMUTABLE"
     )
 
     # then
     assert response["imageTagMutability"] == "IMMUTABLE"
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
 
-    response = client.describe_repositories(repositoryNames=[repo_name])
+    response = client.describe_repositories(repositoryNames=[ECR_REPO])
     assert response["repositories"][0]["imageTagMutability"] == "IMMUTABLE"
 
 
@@ -1659,12 +1642,11 @@ def test_put_image_tag_mutability_error_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.put_image_tag_mutability(
-            repositoryName=repo_name, imageTagMutability="IMMUTABLE"
+            repositoryName=ECR_REPO_NOT_EXIST, imageTagMutability="IMMUTABLE"
         )
 
     # then
@@ -1674,7 +1656,7 @@ def test_put_image_tag_mutability_error_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -1683,13 +1665,12 @@ def test_put_image_tag_mutability_error_invalid_param():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # when
     with pytest.raises(ClientError) as e:
         client.put_image_tag_mutability(
-            repositoryName=repo_name, imageTagMutability="invalid"
+            repositoryName=ECR_REPO, imageTagMutability="invalid"
         )
 
     # then
@@ -1706,26 +1687,25 @@ def test_put_image_tag_mutability_error_invalid_param():
 @mock_ecr
 def test_put_image_scanning_configuration():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
 
-    response = client.describe_repositories(repositoryNames=[repo_name])
+    response = client.describe_repositories(repositoryNames=[ECR_REPO])
     assert response["repositories"][0]["imageScanningConfiguration"] == {
         "scanOnPush": False
     }
 
     # when
     response = client.put_image_scanning_configuration(
-        repositoryName=repo_name, imageScanningConfiguration={"scanOnPush": True}
+        repositoryName=ECR_REPO, imageScanningConfiguration={"scanOnPush": True}
     )
 
     # then
     assert response["imageScanningConfiguration"] == {"scanOnPush": True}
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
 
-    response = client.describe_repositories(repositoryNames=[repo_name])
+    response = client.describe_repositories(repositoryNames=[ECR_REPO])
     assert response["repositories"][0]["imageScanningConfiguration"] == {
         "scanOnPush": True
     }
@@ -1736,12 +1716,12 @@ def test_put_image_scanning_configuration_error_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.put_image_scanning_configuration(
-            repositoryName=repo_name, imageScanningConfiguration={"scanOnPush": True}
+            repositoryName=ECR_REPO_NOT_EXIST,
+            imageScanningConfiguration={"scanOnPush": True},
         )
 
     # then
@@ -1751,16 +1731,15 @@ def test_put_image_scanning_configuration_error_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_set_repository_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -1775,12 +1754,12 @@ def test_set_repository_policy():
 
     # when
     response = client.set_repository_policy(
-        repositoryName=repo_name, policyText=json.dumps(policy)
+        repositoryName=ECR_REPO, policyText=json.dumps(policy)
     )
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert json.loads(response["policyText"]) == policy
 
 
@@ -1789,7 +1768,6 @@ def test_set_repository_policy_error_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -1805,7 +1783,7 @@ def test_set_repository_policy_error_not_exists():
     # when
     with pytest.raises(ClientError) as e:
         client.set_repository_policy(
-            repositoryName=repo_name, policyText=json.dumps(policy)
+            repositoryName=ECR_REPO_NOT_EXIST, policyText=json.dumps(policy)
         )
 
     # then
@@ -1815,7 +1793,7 @@ def test_set_repository_policy_error_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -1824,8 +1802,7 @@ def test_set_repository_policy_error_invalid_param():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
     policy = {
         "Version": "2012-10-17",
         "Statement": [{"Effect": "Allow"}],
@@ -1834,7 +1811,7 @@ def test_set_repository_policy_error_invalid_param():
     # when
     with pytest.raises(ClientError) as e:
         client.set_repository_policy(
-            repositoryName=repo_name, policyText=json.dumps(policy)
+            repositoryName=ECR_REPO, policyText=json.dumps(policy)
         )
 
     # then
@@ -1851,9 +1828,8 @@ def test_set_repository_policy_error_invalid_param():
 @mock_ecr
 def test_get_repository_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -1865,16 +1841,14 @@ def test_get_repository_policy():
             }
         ],
     }
-    client.set_repository_policy(
-        repositoryName=repo_name, policyText=json.dumps(policy)
-    )
+    client.set_repository_policy(repositoryName=ECR_REPO, policyText=json.dumps(policy))
 
     # when
-    response = client.get_repository_policy(repositoryName=repo_name)
+    response = client.get_repository_policy(repositoryName=ECR_REPO)
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert json.loads(response["policyText"]) == policy
 
 
@@ -1883,11 +1857,10 @@ def test_get_repository_policy_error_repo_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
-        client.get_repository_policy(repositoryName=repo_name)
+        client.get_repository_policy(repositoryName=ECR_REPO_NOT_EXIST)
 
     # then
     ex = e.value
@@ -1896,7 +1869,7 @@ def test_get_repository_policy_error_repo_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -1905,12 +1878,11 @@ def test_get_repository_policy_error_policy_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # when
     with pytest.raises(ClientError) as e:
-        client.get_repository_policy(repositoryName=repo_name)
+        client.get_repository_policy(repositoryName=ECR_REPO)
 
     # then
     ex = e.value
@@ -1919,16 +1891,15 @@ def test_get_repository_policy_error_policy_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryPolicyNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"Repository policy does not exist for the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"Repository policy does not exist for the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_delete_repository_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -1940,20 +1911,18 @@ def test_delete_repository_policy():
             }
         ],
     }
-    client.set_repository_policy(
-        repositoryName=repo_name, policyText=json.dumps(policy)
-    )
+    client.set_repository_policy(repositoryName=ECR_REPO, policyText=json.dumps(policy))
 
     # when
-    response = client.delete_repository_policy(repositoryName=repo_name)
+    response = client.delete_repository_policy(repositoryName=ECR_REPO)
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert json.loads(response["policyText"]) == policy
 
     with pytest.raises(ClientError) as e:
-        client.get_repository_policy(repositoryName=repo_name)
+        client.get_repository_policy(repositoryName=ECR_REPO)
 
     assert e.value.response["Error"]["Code"] == "RepositoryPolicyNotFoundException"
 
@@ -1963,11 +1932,10 @@ def test_delete_repository_policy_error_repo_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
-        client.delete_repository_policy(repositoryName=repo_name)
+        client.delete_repository_policy(repositoryName=ECR_REPO_NOT_EXIST)
 
     # then
     ex = e.value
@@ -1976,7 +1944,7 @@ def test_delete_repository_policy_error_repo_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -1985,12 +1953,11 @@ def test_delete_repository_policy_error_policy_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # when
     with pytest.raises(ClientError) as e:
-        client.delete_repository_policy(repositoryName=repo_name)
+        client.delete_repository_policy(repositoryName=ECR_REPO)
 
     # then
     ex = e.value
@@ -1999,16 +1966,15 @@ def test_delete_repository_policy_error_policy_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryPolicyNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"Repository policy does not exist for the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"Repository policy does not exist for the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_put_lifecycle_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     policy = {
         "rules": [
             {
@@ -2026,12 +1992,12 @@ def test_put_lifecycle_policy():
 
     # when
     response = client.put_lifecycle_policy(
-        repositoryName=repo_name, lifecyclePolicyText=json.dumps(policy)
+        repositoryName=ECR_REPO, lifecyclePolicyText=json.dumps(policy)
     )
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert json.loads(response["lifecyclePolicyText"]) == policy
 
 
@@ -2040,7 +2006,6 @@ def test_put_lifecycle_policy_error_repo_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
     policy = {
         "rules": [
             {
@@ -2059,7 +2024,7 @@ def test_put_lifecycle_policy_error_repo_not_exists():
     # when
     with pytest.raises(ClientError) as e:
         client.put_lifecycle_policy(
-            repositoryName=repo_name, lifecyclePolicyText=json.dumps(policy)
+            repositoryName=ECR_REPO_NOT_EXIST, lifecyclePolicyText=json.dumps(policy)
         )
 
     # then
@@ -2069,16 +2034,15 @@ def test_put_lifecycle_policy_error_repo_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_get_lifecycle_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     policy = {
         "rules": [
             {
@@ -2094,15 +2058,15 @@ def test_get_lifecycle_policy():
         ]
     }
     client.put_lifecycle_policy(
-        repositoryName=repo_name, lifecyclePolicyText=json.dumps(policy)
+        repositoryName=ECR_REPO, lifecyclePolicyText=json.dumps(policy)
     )
 
     # when
-    response = client.get_lifecycle_policy(repositoryName=repo_name)
+    response = client.get_lifecycle_policy(repositoryName=ECR_REPO)
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert json.loads(response["lifecyclePolicyText"]) == policy
     assert isinstance(response["lastEvaluatedAt"], datetime)
 
@@ -2112,11 +2076,10 @@ def test_get_lifecycle_policy_error_repo_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
-        client.get_lifecycle_policy(repositoryName=repo_name)
+        client.get_lifecycle_policy(repositoryName=ECR_REPO_NOT_EXIST)
 
     # then
     ex = e.value
@@ -2125,7 +2088,7 @@ def test_get_lifecycle_policy_error_repo_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -2134,12 +2097,11 @@ def test_get_lifecycle_policy_error_policy_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # when
     with pytest.raises(ClientError) as e:
-        client.get_lifecycle_policy(repositoryName=repo_name)
+        client.get_lifecycle_policy(repositoryName=ECR_REPO)
 
     # then
     ex = e.value
@@ -2148,16 +2110,15 @@ def test_get_lifecycle_policy_error_policy_not_exists():
     assert ex.response["Error"]["Code"] == "LifecyclePolicyNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"Lifecycle policy does not exist for the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"Lifecycle policy does not exist for the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_delete_lifecycle_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     policy = {
         "rules": [
             {
@@ -2173,20 +2134,20 @@ def test_delete_lifecycle_policy():
         ]
     }
     client.put_lifecycle_policy(
-        repositoryName=repo_name, lifecyclePolicyText=json.dumps(policy)
+        repositoryName=ECR_REPO, lifecyclePolicyText=json.dumps(policy)
     )
 
     # when
-    response = client.delete_lifecycle_policy(repositoryName=repo_name)
+    response = client.delete_lifecycle_policy(repositoryName=ECR_REPO)
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert json.loads(response["lifecyclePolicyText"]) == policy
     assert isinstance(response["lastEvaluatedAt"], datetime)
 
     with pytest.raises(ClientError) as e:
-        client.get_lifecycle_policy(repositoryName=repo_name)
+        client.get_lifecycle_policy(repositoryName=ECR_REPO)
 
     assert e.value.response["Error"]["Code"] == "LifecyclePolicyNotFoundException"
 
@@ -2196,11 +2157,10 @@ def test_delete_lifecycle_policy_error_repo_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
-        client.delete_lifecycle_policy(repositoryName=repo_name)
+        client.delete_lifecycle_policy(repositoryName=ECR_REPO_NOT_EXIST)
 
     # then
     ex = e.value
@@ -2209,7 +2169,7 @@ def test_delete_lifecycle_policy_error_repo_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -2218,12 +2178,11 @@ def test_delete_lifecycle_policy_error_policy_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client.create_repository(repositoryName=ECR_REPO)
 
     # when
     with pytest.raises(ClientError) as e:
-        client.delete_lifecycle_policy(repositoryName=repo_name)
+        client.delete_lifecycle_policy(repositoryName=ECR_REPO)
 
     # then
     ex = e.value
@@ -2232,7 +2191,7 @@ def test_delete_lifecycle_policy_error_policy_not_exists():
     assert ex.response["Error"]["Code"] == "LifecyclePolicyNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"Lifecycle policy does not exist for the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"Lifecycle policy does not exist for the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
@@ -2244,7 +2203,7 @@ def test_delete_lifecycle_policy_error_policy_not_exists():
 )
 def test_put_registry_policy(actions):
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -2270,7 +2229,7 @@ def test_put_registry_policy(actions):
 @mock_ecr
 def test_put_registry_policy_error_invalid_action():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -2305,7 +2264,7 @@ def test_put_registry_policy_error_invalid_action():
 @mock_ecr
 def test_get_registry_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -2332,7 +2291,7 @@ def test_get_registry_policy():
 @mock_ecr
 def test_get_registry_policy_error_policy_not_exists():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
 
     # when
     with pytest.raises(ClientError) as e:
@@ -2352,7 +2311,7 @@ def test_get_registry_policy_error_policy_not_exists():
 @mock_ecr
 def test_delete_registry_policy():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     policy = {
         "Version": "2012-10-17",
         "Statement": [
@@ -2384,7 +2343,7 @@ def test_delete_registry_policy():
 @mock_ecr
 def test_delete_registry_policy_error_policy_not_exists():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
 
     # when
     with pytest.raises(ClientError) as e:
@@ -2404,24 +2363,23 @@ def test_delete_registry_policy_error_policy_not_exists():
 @mock_ecr
 def test_start_image_scan():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     image_tag = "latest"
     image_digest = client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag="latest",
     )["image"]["imageId"]["imageDigest"]
 
     # when
     response = client.start_image_scan(
-        repositoryName=repo_name, imageId={"imageTag": image_tag}
+        repositoryName=ECR_REPO, imageId={"imageTag": image_tag}
     )
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert response["imageId"] == {"imageDigest": image_digest, "imageTag": image_tag}
     assert response["imageScanStatus"] == {"status": "IN_PROGRESS"}
 
@@ -2431,12 +2389,11 @@ def test_start_image_scan_error_repo_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.start_image_scan(
-            repositoryName=repo_name, imageId={"imageTag": "latest"}
+            repositoryName=ECR_REPO_NOT_EXIST, imageId={"imageTag": "latest"}
         )
 
     # then
@@ -2446,22 +2403,21 @@ def test_start_image_scan_error_repo_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_start_image_scan_error_image_not_exists():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     image_tag = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.start_image_scan(
-            repositoryName=repo_name, imageId={"imageTag": image_tag}
+            repositoryName=ECR_REPO, imageId={"imageTag": image_tag}
         )
 
     # then
@@ -2471,18 +2427,17 @@ def test_start_image_scan_error_image_not_exists():
     assert ex.response["Error"]["Code"] == "ImageNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The image with imageId {{imageDigest:'null', imageTag:'{image_tag}'}} does not exist within the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"The image with imageId {{imageDigest:'null', imageTag:'{image_tag}'}} does not exist within the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_start_image_scan_error_image_tag_digest_mismatch():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     image_digest = client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag="latest",
     )["image"]["imageId"]["imageDigest"]
@@ -2491,7 +2446,7 @@ def test_start_image_scan_error_image_tag_digest_mismatch():
     # when
     with pytest.raises(ClientError) as e:
         client.start_image_scan(
-            repositoryName=repo_name,
+            repositoryName=ECR_REPO,
             imageId={"imageTag": image_tag, "imageDigest": image_digest},
         )
 
@@ -2502,28 +2457,27 @@ def test_start_image_scan_error_image_tag_digest_mismatch():
     assert ex.response["Error"]["Code"] == "ImageNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The image with imageId {{imageDigest:'{image_digest}', imageTag:'{image_tag}'}} does not exist within the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"The image with imageId {{imageDigest:'{image_digest}', imageTag:'{image_tag}'}} does not exist within the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_start_image_scan_error_daily_limit():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     image_tag = "latest"
     client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag="latest",
     )
-    client.start_image_scan(repositoryName=repo_name, imageId={"imageTag": image_tag})
+    client.start_image_scan(repositoryName=ECR_REPO, imageId={"imageTag": image_tag})
 
     # when
     with pytest.raises(ClientError) as e:
         client.start_image_scan(
-            repositoryName=repo_name, imageId={"imageTag": image_tag}
+            repositoryName=ECR_REPO, imageId={"imageTag": image_tag}
         )
 
     # then
@@ -2540,25 +2494,24 @@ def test_start_image_scan_error_daily_limit():
 @mock_ecr
 def test_describe_image_scan_findings():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     image_tag = "latest"
     image_digest = client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag="latest",
     )["image"]["imageId"]["imageDigest"]
-    client.start_image_scan(repositoryName=repo_name, imageId={"imageTag": image_tag})
+    client.start_image_scan(repositoryName=ECR_REPO, imageId={"imageTag": image_tag})
 
     # when
     response = client.describe_image_scan_findings(
-        repositoryName=repo_name, imageId={"imageTag": image_tag}
+        repositoryName=ECR_REPO, imageId={"imageTag": image_tag}
     )
 
     # then
     assert response["registryId"] == ACCOUNT_ID
-    assert response["repositoryName"] == repo_name
+    assert response["repositoryName"] == ECR_REPO
     assert response["imageId"] == {"imageDigest": image_digest, "imageTag": image_tag}
     assert response["imageScanStatus"] == {
         "status": "COMPLETE",
@@ -2588,12 +2541,11 @@ def test_describe_image_scan_findings_error_repo_not_exists():
     # given
     region_name = "eu-central-1"
     client = boto3.client("ecr", region_name=region_name)
-    repo_name = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.describe_image_scan_findings(
-            repositoryName=repo_name, imageId={"imageTag": "latest"}
+            repositoryName=ECR_REPO_NOT_EXIST, imageId={"imageTag": "latest"}
         )
 
     # then
@@ -2603,22 +2555,21 @@ def test_describe_image_scan_findings_error_repo_not_exists():
     assert ex.response["Error"]["Code"] == "RepositoryNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The repository with name '{repo_name}' does not exist in the registry with id '{ACCOUNT_ID}'"
+        == f"The repository with name '{ECR_REPO_NOT_EXIST}' does not exist in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_describe_image_scan_findings_error_image_not_exists():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     image_tag = "not-exists"
 
     # when
     with pytest.raises(ClientError) as e:
         client.describe_image_scan_findings(
-            repositoryName=repo_name, imageId={"imageTag": image_tag}
+            repositoryName=ECR_REPO, imageId={"imageTag": image_tag}
         )
 
     # then
@@ -2628,19 +2579,18 @@ def test_describe_image_scan_findings_error_image_not_exists():
     assert ex.response["Error"]["Code"] == "ImageNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"The image with imageId {{imageDigest:'null', imageTag:'{image_tag}'}} does not exist within the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"The image with imageId {{imageDigest:'null', imageTag:'{image_tag}'}} does not exist within the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_describe_image_scan_findings_error_scan_not_exists():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
-    repo_name = "test-repo"
-    client.create_repository(repositoryName=repo_name)
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    client.create_repository(repositoryName=ECR_REPO)
     image_tag = "latest"
     client.put_image(
-        repositoryName=repo_name,
+        repositoryName=ECR_REPO,
         imageManifest=json.dumps(_create_image_manifest()),
         imageTag=image_tag,
     )
@@ -2648,7 +2598,7 @@ def test_describe_image_scan_findings_error_scan_not_exists():
     # when
     with pytest.raises(ClientError) as e:
         client.describe_image_scan_findings(
-            repositoryName=repo_name, imageId={"imageTag": image_tag}
+            repositoryName=ECR_REPO, imageId={"imageTag": image_tag}
         )
 
     # then
@@ -2658,14 +2608,14 @@ def test_describe_image_scan_findings_error_scan_not_exists():
     assert ex.response["Error"]["Code"] == "ScanNotFoundException"
     assert (
         ex.response["Error"]["Message"]
-        == f"Image scan does not exist for the image with '{{imageDigest:'null', imageTag:'{image_tag}'}}' in the repository with name '{repo_name}' in the registry with id '{ACCOUNT_ID}'"
+        == f"Image scan does not exist for the image with '{{imageDigest:'null', imageTag:'{image_tag}'}}' in the repository with name '{ECR_REPO}' in the registry with id '{ACCOUNT_ID}'"
     )
 
 
 @mock_ecr
 def test_put_replication_configuration():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     config = {
         "rules": [{"destinations": [{"region": "eu-west-1", "registryId": ACCOUNT_ID}]}]
     }
@@ -2680,7 +2630,7 @@ def test_put_replication_configuration():
 @mock_ecr
 def test_put_replication_configuration_error_feature_disabled():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     config = {
         "rules": [
             {
@@ -2737,7 +2687,7 @@ def test_put_replication_configuration_error_same_source():
 @mock_ecr
 def test_describe_registry():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
 
     # when
     response = client.describe_registry()
@@ -2750,7 +2700,7 @@ def test_describe_registry():
 @mock_ecr
 def test_describe_registry_after_update():
     # given
-    client = boto3.client("ecr", region_name="eu-central-1")
+    client = boto3.client("ecr", region_name=ECR_REGION)
     config = {
         "rules": [
             {"destinations": [{"region": "eu-west-1", "registryId": ACCOUNT_ID}]},
@@ -2763,3 +2713,41 @@ def test_describe_registry_after_update():
 
     # then
     assert response["replicationConfiguration"] == config
+
+
+@mock_ecr
+def test_ecr_image_digest():
+    # given
+    client = boto3.client("ecr", region_name=ECR_REGION)
+    digest = "sha256:826b6832e45ba17d625debc95ae8554e148550b00c05b47fa8f7be1c555bc83c"
+    client.create_repository(repositoryName=ECR_REPO)
+    image_manifest = {
+        "config": {
+            "digest": "sha256:6442bc26a7c562f5afe6467dab36365c709909f6a81afcecfc0c25cff0f1bab0",
+            "mediaType": "application/vnd.docker.container.image.v1+json",
+            "size": 5205,
+        },
+        "layers": [
+            {
+                "digest": "sha256:b35e87b5838011a3637be660e4238af9a55e4edc74404c990f7a558e7f416658",
+                "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
+                "size": 26690191,
+            }
+        ],
+        "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
+        "schemaVersion": 2,
+    }
+
+    # when
+    put_response = client.put_image(
+        repositoryName=ECR_REPO,
+        imageManifest=json.dumps(image_manifest),
+        imageManifestMediaType="application/vnd.oci.image.manifest.v1+json",
+        imageTag="test1",
+        imageDigest=digest,
+    )
+    describe_response = client.describe_images(repositoryName=ECR_REPO)
+
+    # then
+    assert put_response["image"]["imageId"]["imageDigest"] == digest
+    assert describe_response["imageDetails"][0]["imageDigest"] == digest