-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathtest_query_params.py
More file actions
28 lines (20 loc) · 958 Bytes
/
test_query_params.py
File metadata and controls
28 lines (20 loc) · 958 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from http import HTTPStatus
import pytest
from tornado import testing
from tornado.httpclient import HTTPError
from tests import utils
class TestQueryParamsHandler(utils.HandlerTestCase):
@testing.gen_test
def test_format_url(self):
with pytest.raises(HTTPError) as e:
yield self.http_client.fetch(self.get_url('/export'), method='GET')
assert e.value.message == 'Bad Request'
assert e.value.code == HTTPStatus.BAD_REQUEST
with pytest.raises(HTTPError) as e:
yield self.http_client.fetch(self.get_url('/export?format=pdf'), method='GET')
assert e.value.message == 'Bad Request'
assert e.value.code == HTTPStatus.BAD_REQUEST
with pytest.raises(HTTPError) as e:
yield self.http_client.fetch(self.get_url('/export?url=http://test.com'), method='GET')
assert e.value.message == 'Bad Request'
assert e.value.code == HTTPStatus.BAD_REQUEST