betamaxpy / betamax

A VCR imitation designed only for python-requests.
https://betamax.readthedocs.io/en/latest/
Other
565 stars 62 forks source link

Tests failing #146

Closed hroncok closed 6 years ago

hroncok commented 6 years ago

The tests are failing on Travis CI and locally:

====================================================== FAILURES =======================================================
_________________________________ TestRecordOnce.test_replays_response_from_cassette __________________________________

self = <tests.integration.test_record_modes.TestRecordOnce testMethod=test_replays_response_from_cassette>

    def test_replays_response_from_cassette(self):
        s = self.session
        with Betamax(s).use_cassette('test_replays_response') as betamax:
            self.cassette_path = betamax.current_cassette.cassette_path
            assert betamax.current_cassette.is_empty() is True
            r0 = s.get('http://httpbin.org/get')
            assert r0.status_code == 200
            assert betamax.current_cassette.interactions != []
            assert len(betamax.current_cassette.interactions) == 1
            r1 = s.get('http://httpbin.org/get')
            assert len(betamax.current_cassette.interactions) == 2
            assert r1.status_code == 200
            r0_headers = r0.headers.copy()
            r0_headers.pop('Date')
            r0_headers.pop('Age', None)
            r1_headers = r1.headers.copy()
            r1_headers.pop('Date')
            r1_headers.pop('Age', None)
            # NOTE(sigmavirus24): This fails if the second request is
            # technically a second later. Ignoring the Date headers allows
            # this test to succeed.
>           assert r0_headers == r1_headers
E           AssertionError: assert {'Server': 'm...-Origin': '*'} == {'Server': 'me...-Origin': '*'}
E             Full diff:
E             - {'Server': 'meinheld/0.6.1', 'Content-Length': '267', 'Via': '1.1 vegur', 'Access-Control-Allow-Credentials': 'true', 'X-Processed-Time': '0.0011579990387', 'Connection': 'keep-alive', 'X-Powered-By': 'Flask', 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*'}
E             ?                                                                                                                                                ^^  ^^^^^^^^^^^^^^^^^^^^^^^
E             + {'Server': 'meinheld/0.6.1', 'Content-Length': '267', 'Via': '1.1 vegur', 'Access-Control-Allow-Credentials'...
E             
E             ...Full output truncated (2 lines hidden), use '-vv' to show

tests/integration/test_record_modes.py:38: AssertionError

I'll have a look at this first so we can rely on Travis CI once again.