Example #1
0
 def test_enforce_json(self):
     with pytest.raises(CortexError):
         HTTPClient(
             url=HTTPBIN,
             port=80,
             enforce_json=True,
             headers={"Accept": "application/json"},
         ).request(method="GET", endpoint="/")
Example #2
0
 def test_raise_for_status(self):
     with pytest.raises(HTTPError):
         HTTPClient(url=HTTPBIN, port=80, raise_for_status=True).request(
             method="GET", endpoint="/status/400"
         )
Example #3
0
 def test_request_unexpected_kwargs(self):
     with pytest.raises(UnexpectedKwargsError):
         HTTPClient(url=TARPIT).request(method="GET", foo="foo")
Example #4
0
 def test_read_timeout(self):
     with pytest.raises(HTTPError):
         HTTPClient(url=HTTPBIN, port=80).request(
             method="GET", timeout=(None, 0.0001), endpoint="/"
         )
Example #5
0
 def test_connection_timeout(self):
     with pytest.raises(HTTPError):
         HTTPClient(url=TARPIT).request(method="GET", timeout=(0.1, None))
Example #6
0
 def test_invalid_url(self):
     with pytest.raises(HTTPError):
         HTTPClient(url="asdaksjhdakjsdh").request(method="GET")
     with pytest.raises(HTTPError):
         HTTPClient(url="http://").request(method="GET")
Example #7
0
    def test_entry_points(self):

        HTTPClient(url=TARPIT).request
Example #8
0
 def test_session(self):
     session = HTTPClient(url=TARPIT)
     QueryService(session=session)