mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
responseloader: use PreparedRequest() to ensure url properly formatted
tests: update tests for latest, live data
This commit is contained in:
parent
80d9805a58
commit
ea3efdf84d
@ -18,7 +18,8 @@ from six.moves.urllib.parse import urlsplit
|
|||||||
import uuid
|
import uuid
|
||||||
import six
|
import six
|
||||||
import itertools
|
import itertools
|
||||||
#import requests
|
|
||||||
|
from requests.models import PreparedRequest
|
||||||
import urllib3
|
import urllib3
|
||||||
|
|
||||||
|
|
||||||
@ -241,6 +242,10 @@ class LiveWebLoader(BaseLoader):
|
|||||||
method = input_req.get_req_method()
|
method = input_req.get_req_method()
|
||||||
data = input_req.get_req_body()
|
data = input_req.get_req_body()
|
||||||
|
|
||||||
|
p = PreparedRequest()
|
||||||
|
p.prepare_url(load_url, None)
|
||||||
|
load_url = p.url
|
||||||
|
|
||||||
try:
|
try:
|
||||||
upstream_res = self.pool.urlopen(method=method,
|
upstream_res = self.pool.urlopen(method=method,
|
||||||
url=load_url,
|
url=load_url,
|
||||||
|
@ -27,7 +27,7 @@ def simpleapp():
|
|||||||
'./testdata/'
|
'./testdata/'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return app.application
|
return app
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ def test_mem_agg_index_2(agg):
|
|||||||
{"timestamp": "20100511201151", "load_url": "http://wayback.archive-it.org/all/20100511201151id_/http://example.com/", "source": "ait"},
|
{"timestamp": "20100511201151", "load_url": "http://wayback.archive-it.org/all/20100511201151id_/http://example.com/", "source": "ait"},
|
||||||
{"timestamp": "20100514231857", "load_url": "http://web.archive.org/web/20100514231857id_/http://example.com/", "source": "ia"},
|
{"timestamp": "20100514231857", "load_url": "http://web.archive.org/web/20100514231857id_/http://example.com/", "source": "ia"},
|
||||||
{"timestamp": "20100514231857", "load_url": "http://wayback.archive-it.org/all/20100514231857id_/http://example.com/", "source": "ait"},
|
{"timestamp": "20100514231857", "load_url": "http://wayback.archive-it.org/all/20100514231857id_/http://example.com/", "source": "ait"},
|
||||||
{"timestamp": "20100519202418", "load_url": "http://web.archive.org/web/20100519202418id_/http://example.com/", "source": "ia"}]
|
{"timestamp": "20100510233601", "load_url": "http://web.archive.org/web/20100510233601id_/http://example.com/", "source": "ia"}]
|
||||||
|
|
||||||
assert(to_json_list(res) == exp)
|
assert(to_json_list(res) == exp)
|
||||||
assert(errs == {'rhiz': "NotFoundException('http://webenact.rhizome.org/vvork/http://example.com/',)"})
|
assert(errs == {'rhiz': "NotFoundException('http://webenact.rhizome.org/vvork/http://example.com/',)"})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user