mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
tests: add 'bad.cdx' for testing cdx lines with missing original for revisit,
missing/non-existant warc
This commit is contained in:
parent
913a1e9f31
commit
fb07775d38
@ -54,7 +54,7 @@ com,example)/?example=1 20140103030321 http://example.com?example=1 text/html 20
|
|||||||
com,example)/?example=1 20140103030341 http://example.com?example=1 warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 553 1864 example.warc.gz
|
com,example)/?example=1 20140103030341 http://example.com?example=1 warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 553 1864 example.warc.gz
|
||||||
|
|
||||||
# Filter exact invert
|
# Filter exact invert
|
||||||
>>> cdx_ops_test(url = 'http://example.com', sources = [test_cdx_dir], matchType = 'prefix', filter = ['!=urlkey:com,example)/?example=1', '!=urlkey:com,example)/?example=2'])
|
>>> cdx_ops_test(url = 'http://example.com', sources = [test_cdx_dir], matchType = 'prefix', filter = ['!=urlkey:com,example)/?example=1', '!=urlkey:com,example)/?example=2', '!=urlkey:com,example)/?example=3'])
|
||||||
com,example)/ 20130729195151 http://test@example.com/ warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 591 355 example-url-agnostic-revisit.warc.gz
|
com,example)/ 20130729195151 http://test@example.com/ warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 591 355 example-url-agnostic-revisit.warc.gz
|
||||||
com,example)/ 20140127171200 http://example.com text/html 200 B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 1046 334 dupes.warc.gz
|
com,example)/ 20140127171200 http://example.com text/html 200 B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 1046 334 dupes.warc.gz
|
||||||
com,example)/ 20140127171251 http://example.com warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 553 11875 dupes.warc.gz
|
com,example)/ 20140127171251 http://example.com warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 553 11875 dupes.warc.gz
|
||||||
|
5
sample_archive/cdx/bad.cdx
Normal file
5
sample_archive/cdx/bad.cdx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
CDX N b a m s k r M S V g
|
||||||
|
com,example)/?example=2 20140703030321 http://example.com?example=2 text/html 200 B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 1987 0 non-existent.warc
|
||||||
|
com,example)/?example=2 20140603030351 http://example.com?example=2 warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36B - - 504 2701 example-extra.warc
|
||||||
|
com,example)/?example=3 20140703030321 http://example.com?example=3 text/html 200 B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36A - - 1987 0 non-existent.warc
|
||||||
|
com,example)/?example=3 20140603030351 http://example.com?example=3 warc/revisit - B2LTWWPUOYAH7UIPQ7ZUPQ4VMBSVC36B - - 504 2701 example-extra.warc
|
@ -240,6 +240,23 @@ class TestWb:
|
|||||||
resp = self.testapp.get(uri, headers = [('Referer', referrer), ('Host', host)], status = 302)
|
resp = self.testapp.get(uri, headers = [('Referer', referrer), ('Host', host)], status = 302)
|
||||||
assert resp.status_int == 302
|
assert resp.status_int == 302
|
||||||
|
|
||||||
|
def test_not_existant_warc_other_capture(self):
|
||||||
|
resp = self.testapp.get('/pywb/20140703030321mp_/http://example.com?example=2')
|
||||||
|
assert resp.status_int == 302
|
||||||
|
assert resp.headers['Location'].endswith('/pywb/20140603030341mp_/http://example.com?example=2')
|
||||||
|
|
||||||
|
def test_missing_revisit_other_capture(self):
|
||||||
|
resp = self.testapp.get('/pywb/20140603030351mp_/http://example.com?example=2')
|
||||||
|
assert resp.status_int == 302
|
||||||
|
assert resp.headers['Location'].endswith('/pywb/20140603030341mp_/http://example.com?example=2')
|
||||||
|
|
||||||
|
def test_not_existant_warc_no_other(self):
|
||||||
|
resp = self.testapp.get('/pywb/20140703030321mp_/http://example.com?example=3', status = 503)
|
||||||
|
assert resp.status_int == 503
|
||||||
|
|
||||||
|
def test_missing_revisit_no_other(self):
|
||||||
|
resp = self.testapp.get('/pywb/20140603030351mp_/http://example.com?example=3', status = 503)
|
||||||
|
assert resp.status_int == 503
|
||||||
|
|
||||||
def test_post_1(self):
|
def test_post_1(self):
|
||||||
resp = self.testapp.post('/pywb/mp_/httpbin.org/post', {'foo': 'bar', 'test': 'abc'})
|
resp = self.testapp.post('/pywb/mp_/httpbin.org/post', {'foo': 'bar', 'test': 'abc'})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user