Skip to content

Commit

Permalink
Add failing test for view mode redirects
Browse files Browse the repository at this point in the history
Redirects are messy in view mode (see #109). This adds a test for them, even though it currently fails.
  • Loading branch information
Mr0grog committed Feb 23, 2023
1 parent 6cb13f9 commit 270d34d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions wayback/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,21 @@ def test_get_memento_raises_for_mementos_that_redirect_in_a_loop():
'20200925075402')


@ia_vcr.use_cassette()
def test_get_memento_with_redirect_in_view_mode():
"""
Redirects in view mode respond with different headers, status codes, and
bodies that other modes. They require special handling and testing.
"""
with WaybackClient() as client:
memento = client.get_memento(
'https://www.whitehouse.gov/administration/eop/ostp/about/student/faqs',
timestamp='20201027215555',
mode=Mode.view)
assert len(memento.history) == 1 # memento redirects
assert len(memento.debug_history) == 2 # actual HTTP redirects


@ia_vcr.use_cassette()
def test_get_memento_should_fail_for_non_playbackable_mementos():
with WaybackClient() as client:
Expand Down

0 comments on commit 270d34d

Please sign in to comment.