Ejemplo n.º 1
0
def test_http404(client, params):
    with pytest.raises(NotFound404Error):
        client.torrents_rename(hash="asdf", new_torrent_name="erty")

    response = MockResponse(status_code=404, text="")
    with pytest.raises(HTTPError):
        Request.handle_error_responses(data={}, params=params, response=response)
Ejemplo n.º 2
0
def test_http404(client, params):
    # 404 for a post
    with pytest.raises(NotFound404Error):
        client.torrents_rename(hash="asdf", new_torrent_name="erty")

    # 404 for a get
    with pytest.raises(NotFound404Error):
        client._get(
            _name="torrents", _method="rename", params={"hash": "asdf", "name": "erty"}
        )

    response = MockResponse(status_code=404, text="")
    with pytest.raises(HTTPError):
        p = dict(data={}, params=params)
        Request.handle_error_responses(params=p, response=response)
Ejemplo n.º 3
0
def test_http_error(status_code):
    response = MockResponse(status_code=status_code, text="asdf")
    with pytest.raises(HTTPError):
        Request.handle_error_responses(data={}, params={}, response=response)
Ejemplo n.º 4
0
def test_http500(status_code):
    response = MockResponse(status_code=status_code, text="asdf")
    with pytest.raises(InternalServerError500Error):
        Request.handle_error_responses(data={}, params={}, response=response)