Repository: getmoto/moto
Pull request #6597 (2023-08-04 10:15:46)

Add missing override
This PR https://github.com/getmoto/moto/pull/6451/ generates a regression bug.

Step to reproduce
```
from moto.core.models import responses_mock

    if responses_mock.registered():
        # do something
```

This will throw an exception 
` AttributeError: 'CustomRegistry' object has no attribute '_responses'`

It's due to the child class misses the implementation of `registered()`

This PR fixes the issue.

wangsha: @bblommers fixes pushed
wangsha: @bblommers fixes pushed

wangsha: @bblommers fixes pushed

Patch:
diff --git a/.github/workflows/data-update_ec2-instance-offerings.yml b/.github/workflows/data-update_ec2-instance-offerings.yml
index 540636d13..f59d8ebee 100644
--- a/.github/workflows/data-update_ec2-instance-offerings.yml
+++ b/.github/workflows/data-update_ec2-instance-offerings.yml
@@ -32,7 +32,7 @@ jobs:
         python-version: 3.9
 
     - name: Configure AWS
-      uses: aws-actions/configure-aws-credentials@v3
+      uses: aws-actions/configure-aws-credentials@v4
       with:
         aws-region: us-east-1
         role-to-assume: arn:aws:iam::486285699788:role/GithubActionsRole
diff --git a/.github/workflows/data-update_ec2-instance-types.yml b/.github/workflows/data-update_ec2-instance-types.yml
index 87420603c..5cc490eba 100644
--- a/.github/workflows/data-update_ec2-instance-types.yml
+++ b/.github/workflows/data-update_ec2-instance-types.yml
@@ -31,7 +31,7 @@ jobs:
         python-version: 3.9
 
     - name: Configure AWS
-      uses: aws-actions/configure-aws-credentials@v3
+      uses: aws-actions/configure-aws-credentials@v4
       with:
         aws-region: us-east-1
         role-to-assume: arn:aws:iam::486285699788:role/GithubActionsRole
diff --git a/.github/workflows/data-update_ssm-default-amis.yml b/.github/workflows/data-update_ssm-default-amis.yml
index 8a5db8a91..3496021b0 100644
--- a/.github/workflows/data-update_ssm-default-amis.yml
+++ b/.github/workflows/data-update_ssm-default-amis.yml
@@ -31,7 +31,7 @@ jobs:
         python-version: 3.9
 
     - name: Configure AWS
-      uses: aws-actions/configure-aws-credentials@v3
+      uses: aws-actions/configure-aws-credentials@v4
       with:
         aws-region: us-east-1
         role-to-assume: arn:aws:iam::486285699788:role/GithubActionsRole
diff --git a/.github/workflows/data-update_ssm-default-parameters.yml b/.github/workflows/data-update_ssm-default-parameters.yml
index 1e410071c..3fd76960d 100644
--- a/.github/workflows/data-update_ssm-default-parameters.yml
+++ b/.github/workflows/data-update_ssm-default-parameters.yml
@@ -32,7 +32,7 @@ jobs:
         python-version: 3.9
 
     - name: Configure AWS
-      uses: aws-actions/configure-aws-credentials@v3
+      uses: aws-actions/configure-aws-credentials@v4
       with:
         aws-region: us-east-1
         role-to-assume: arn:aws:iam::486285699788:role/GithubActionsRole
diff --git a/moto/core/responses_custom_registry.py b/moto/core/responses_custom_registry.py
index b4642e852..3de222fe7 100644
--- a/moto/core/responses_custom_registry.py
+++ b/moto/core/responses_custom_registry.py
@@ -17,6 +17,13 @@ class CustomRegistry(responses.registries.FirstMatchRegistry):
     def __init__(self) -> None:
         self._registered: Dict[str, List[responses.BaseResponse]] = defaultdict(list)
 
+    @property
+    def registered(self) -> List[responses.BaseResponse]:
+        res = []
+        for resps in self._registered.values():
+            res += resps
+        return res
+
     def add(self, response: responses.BaseResponse) -> responses.BaseResponse:
         if response not in self._registered[response.method]:
             self._registered[response.method].append(response)


Test patch:
diff --git a/tests/test_apigateway/test_apigateway_integration.py b/tests/test_apigateway/test_apigateway_integration.py
index 87a17c631..ae44bf078 100644
--- a/tests/test_apigateway/test_apigateway_integration.py
+++ b/tests/test_apigateway/test_apigateway_integration.py
@@ -15,7 +15,8 @@ def test_http_integration():
     responses_mock.add(
         responses_mock.GET, "http://httpbin.org/robots.txt", body="a fake response"
     )
-
+    registered = responses_mock.registered()
+    assert isinstance(registered, list) and len(registered) > 1
     region_name = "us-west-2"
     client = boto3.client("apigateway", region_name=region_name)
     response = client.create_rest_api(name="my_api", description="this is my api")