Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clear X-Amzn-Trace-Id in httbin.org responses #202

Merged
merged 1 commit into from
Dec 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion tests/integration/test_record_modes.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import re

from betamax import Betamax, BetamaxError

from tests.integration.helper import IntegrationHelper
Expand Down Expand Up @@ -39,8 +41,15 @@ def test_replays_response_from_cassette(self):
# this test to succeed.
# NOTE(hroncok): httpbin.org added X-Processed-Time header that
# can possibly differ (and often does)
r0_content = r0.content.decode(encoding='utf-8', errors='strict')
r1_content = r1.content.decode(encoding='utf-8', errors='strict')
r0_content = re.sub('"X-Amzn-Trace-Id": "[^"]+"', '"X-Amzn-Trace-Id": ""', r0_content)
r1_content = re.sub('"X-Amzn-Trace-Id": "[^"]+"', '"X-Amzn-Trace-Id": ""', r1_content)
# NOTE(jhatler): httpbin.org added "X-Amzn-Trace-Id" to their
# response, which is a unique ID that will differ between requests.
# We remove it from the response body before comparing.
assert r0_headers == r1_headers
assert r0.content == r1.content
assert r0_content == r1_content


class TestRecordNone(IntegrationHelper):
Expand Down
Loading