Skip to content

Commit

Permalink
Merge pull request #202 from jhatler/fix/httpbinAmznTrace
Browse files Browse the repository at this point in the history
fix: clear X-Amzn-Trace-Id in httbin.org responses
  • Loading branch information
sigmavirus24 authored Dec 29, 2023
2 parents 7db266c + b697764 commit c75cfc7
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit c75cfc7

Please sign in to comment.