Skip to content

Commit 20816c4

Browse files
committed
overload jp_fetch
1 parent 8694e53 commit 20816c4

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

tests/test_files.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,28 @@ def maybe_hidden(request):
2525
TIMEOUTS = dict(
2626
# default is 20.0
2727
connect_timeout=0.0,
28-
# already set upstream?
29-
# request_timeout=40.0
28+
# needs patch below
29+
request_timeout=0.0
3030
)
3131

32+
# shouldn't be overloading this
33+
@pytest.fixture
34+
def jp_fetch(jp_serverapp, http_server_client, jp_auth_header, jp_base_url):
35+
def client_fetch(*parts, headers={}, params={}, **kwargs):
36+
# Handle URL strings
37+
path_url = url_escape(url_path_join(jp_base_url, *parts), plus=False)
38+
params_url = urllib.parse.urlencode(params)
39+
url = path_url + "?" + params_url
40+
# Add auth keys to header
41+
headers.update(jp_auth_header)
42+
# Make request.
43+
kwargs.setdefault("request_timeout", 20.0)
44+
return http_server_client.fetch(
45+
url, headers=headers, **kwargs
46+
)
47+
return client_fetch
48+
49+
3250
async def fetch_expect_200(jp_fetch, *path_parts):
3351
r = await jp_fetch('files', *path_parts, method='GET', **TIMEOUTS)
3452
assert (r.body.decode() == path_parts[-1]), (path_parts, r.body)

0 commit comments

Comments
 (0)