File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88
99import webtest
1010from fakeredis import FakeStrictRedis
11- from mock import patch
11+ from mock import Mock , patch
1212import pytest
1313
1414import os
4242 'http://web.archive.org/web/{timestamp}id_/{url}' )
4343}
4444
45+ IA_CDX_IANA = b'''\
46+ org,iana)/ 20161103124134 http://iana.org/ unk 302 3I42H3S6NNFQ2MSVX7XZKYAYSCX5QBYJ 320'''
4547
4648
4749
@@ -212,14 +214,16 @@ def test_agg_select_mem_2(self):
212214
213215 assert 'ResErrors' not in resp .headers
214216
215- def test_agg_select_mem_unrewrite_headers (self ):
217+ @patch .object (ia_cdx ['ia-cdx' ].sesh , 'get' )
218+ def test_agg_select_mem_unrewrite_headers (self , mock_get ):
219+ mock_get .return_value = Mock (content = IA_CDX_IANA )
220+
216221 resp = self .testapp .get ('/cdx_api/resource?closest=20161103124134&url=http://iana.org/' )
217222
218223 assert resp .headers ['Warcserver-Source-Coll' ] == 'ia-cdx'
219224
220225 buff = BytesIO (resp .body )
221226 record = ArcWarcRecordLoader ().parse_record_stream (buff , no_record_parse = False )
222- print (record .http_headers )
223227 assert record .http_headers .get_statuscode () == '200'
224228 #assert record.http_headers.get_header('Location') == 'https://www.iana.org/'
225229
You can’t perform that action at this time.
0 commit comments