I do not want to push actual api key. When I replaced the actual key on code base this error is generated
E vcr.errors.CannotOverwriteExistingCassetteException: Can't overwrite existing cassette ('/app/armor_backend/users/tests/recordings/test_user_with_empty_code.yaml') in your current record mode ('once').
E No match for the request (<Request (GET) https://api.moesif.net/v1/config>) was found.
E Found 1 similar requests with 0 different matcher(s) :
E
E 1 - (<Request (GET) https://api.moesif.net/v1/config>).
E Matchers succeeded : ['uri', 'method']
E Matchers failed :
/usr/local/lib/python3.10/site-packages/vcr/stubs/__init__.py:231: CannotOverwriteExistingCassetteException
----------------------------- Captured stdout call -----------------------------
Unauthorized access getting application configuration. Please check your Appplication Id.
------------------------------ Captured log call -------------------------------
ERROR moesifapi.controllers.base_controller:base_controller.py:41 HTTP Response not ok [response status: 401 | header: {'Connection': 'keep-alive', 'Content-Length': '153', 'Content-Type': 'application/json', 'Date': 'Wed, 09 Feb 2022 06:18:37 GMT', 'content-encoding': 'gzip', 'vary': 'Origin,Accept-Encoding'} | raw_body: {"moesif_error":{"code":"auth_error","msg":"X-Moesif-Application-Id request header is invalid. Please get a valid Moesif Collector Application Id from your Moesif account"}}]
I skipped all outgoing and incoming calls from logging for testing. But still moesif is being called somehow.
Here is my test case
@vcr.use_cassette
def test_user_with_invalid_code(
self, client, use_invalid_code
):
response = client.post(
self.endpoint,
content_type="application/json",
data=json.dumps(use_invalid_code),
)
assert response.status_code == status.HTTP_400_BAD_REQUEST
I tried to skip logging all the incoming and outgoing calls but no luck