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)
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)
def test_is_version_less_than(): assert Request._is_version_less_than("1", "1", lteq=True) is True assert Request._is_version_less_than("1", "1", lteq=False) is False assert Request._is_version_less_than("1.5", "1", lteq=True) is False assert Request._is_version_less_than("1.5", "1", lteq=False) is False assert Request._is_version_less_than("1", "1.5", lteq=True) is True assert Request._is_version_less_than("1", "1.5", lteq=False) is True
def test_is_version_less_than(): assert Request._is_version_less_than('1', '1', lteq=True) is True assert Request._is_version_less_than('1', '1', lteq=False) is False assert Request._is_version_less_than('1.5', '1', lteq=True) is False assert Request._is_version_less_than('1.5', '1', lteq=False) is False assert Request._is_version_less_than('1', '1.5', lteq=True) is True assert Request._is_version_less_than('1', '1.5', lteq=False) is True
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)
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)
def test_http_error(status_code): response = MockResponse(status_code=status_code, text="asdf") with pytest.raises(exceptions.HTTPError): p = dict(data={}, params={}) Request._handle_error_responses(args=p, response=response)