コード例 #1
0
ファイル: test_cassette.py プロジェクト: jerith/betamax
 def test_deserialize_response_old(self):
     """For the previous version of Betamax and backwards compatibility."""
     s = {
         "body": {"string": decode("foo"), "encoding": "utf-8"},
         "headers": {"Content-Type": decode("application/json")},
         "url": "http://example.com/",
         "status_code": 200,
         "recorded_at": "2013-08-31T00:00:01",
     }
     r = util.deserialize_response(s)
     assert r.content == b"foo"
     assert r.encoding == "utf-8"
     assert r.headers == {"Content-Type": "application/json"}
     assert r.url == "http://example.com/"
     assert r.status_code == 200
コード例 #2
0
ファイル: test_cassette.py プロジェクト: jerith/betamax
 def test_deserialize_response_new(self):
     """This adheres to the correct cassette specification."""
     s = {
         "body": {"string": decode("foo"), "encoding": "utf-8"},
         "headers": {"Content-Type": [decode("application/json")]},
         "url": "http://example.com/",
         "status": {"code": 200, "message": "OK"},
         "recorded_at": "2013-08-31T00:00:01",
     }
     r = util.deserialize_response(s)
     assert r.content == b"foo"
     assert r.encoding == "utf-8"
     assert r.headers == {"Content-Type": "application/json"}
     assert r.url == "http://example.com/"
     assert r.status_code == 200
     assert r.reason == "OK"
コード例 #3
0
ファイル: test_cassette.py プロジェクト: eriol/betamax
 def test_deserialize_response_old(self):
     """For the previous version of Betamax and backwards compatibility."""
     s = {
         'body': {
             'string': decode('foo'),
             'encoding': 'utf-8'
         },
         'headers': {
             'Content-Type': decode('application/json')
         },
         'url': 'http://example.com/',
         'status_code': 200,
         'recorded_at': '2013-08-31T00:00:01'
     }
     r = util.deserialize_response(s)
     assert r.content == b'foo'
     assert r.encoding == 'utf-8'
     assert r.headers == {'Content-Type': 'application/json'}
     assert r.url == 'http://example.com/'
     assert r.status_code == 200
コード例 #4
0
ファイル: test_cassette.py プロジェクト: dgouldin/betamax
 def test_deserialize_response_old(self):
     """For the previous version of Betamax and backwards compatibility."""
     s = {
         'body': {
             'string': decode('foo'),
             'encoding': 'utf-8'
         },
         'headers': {
             'Content-Type': decode('application/json')
         },
         'url': 'http://example.com/',
         'status_code': 200,
         'recorded_at': '2013-08-31T00:00:01'
     }
     r = util.deserialize_response(s)
     assert r.content == b'foo'
     assert r.encoding == 'utf-8'
     assert r.headers == {'Content-Type': 'application/json'}
     assert r.url == 'http://example.com/'
     assert r.status_code == 200
コード例 #5
0
ファイル: test_cassette.py プロジェクト: dgouldin/betamax
 def test_deserialize_response_new(self):
     """This adheres to the correct cassette specification."""
     s = {
         'body': {
             'string': decode('foo'),
             'encoding': 'utf-8'
         },
         'headers': {
             'Content-Type': [decode('application/json')]
         },
         'url': 'http://example.com/',
         'status': {'code': 200, 'message': 'OK'},
         'recorded_at': '2013-08-31T00:00:01'
     }
     r = util.deserialize_response(s)
     assert r.content == b'foo'
     assert r.encoding == 'utf-8'
     assert r.headers == {'Content-Type': 'application/json'}
     assert r.url == 'http://example.com/'
     assert r.status_code == 200
     assert r.reason == 'OK'
コード例 #6
0
 def test_deserialize_response_new(self):
     """This adheres to the correct cassette specification."""
     s = {
         'body': {
             'string': decode('foo'),
             'encoding': 'utf-8'
         },
         'headers': {
             'Content-Type': [decode('application/json')]
         },
         'url': 'http://example.com/',
         'status': {'code': 200, 'message': 'OK'},
         'recorded_at': '2013-08-31T00:00:01'
     }
     r = util.deserialize_response(s)
     assert r.content == b'foo'
     assert r.encoding == 'utf-8'
     assert r.headers == {'Content-Type': 'application/json'}
     assert r.url == 'http://example.com/'
     assert r.status_code == 200
     assert r.reason == 'OK'