def test_post_except_json_decode(mock): url = "http://google.com" mock.ClientSession = SessionExceptJSONDecode loop = asyncio.get_event_loop() result = loop.run_until_complete(http_post(url)) assert result is None
def test_post_except_client_connection(mock): url = "http://google.com" mock.ClientSession = SessionExceptClientConnection loop = asyncio.get_event_loop() with pytest.raises(HttpError): loop.run_until_complete(http_post(url))
def test_post_except_server_timeout(mock): url = "http://google.com" mock.ClientSession = SessionExceptServerTimeout loop = asyncio.get_event_loop() with pytest.raises(HttpError): loop.run_until_complete(http_post(url))
def test_POST_404_NOTFOUND(mock): url = "http://google.com" mock.ClientSession = Session404 loop = asyncio.get_event_loop() with pytest.raises(HttpError): loop.run_until_complete(http_post(url))