예제 #1
0
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
예제 #2
0
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))
예제 #3
0
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))
예제 #4
0
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))