def test_request_refund_gateway_timeout_response(client: Client, httpx_mock: HTTPXMock): url = client.context + REFUND_PATH httpx_mock.add_response(url=url, method="POST", status_code=httpx.codes.GATEWAY_TIMEOUT) with pytest.raises(ServerError): client.request_refund(trans_ref=get_random_string(), phone="22991617451")
def test_request_refund_not_found_response(client: Client, httpx_mock: HTTPXMock): url = client.context + REFUND_PATH httpx_mock.add_response(url=url, method="POST", status_code=httpx.codes.NOT_FOUND) with pytest.raises(InvalidClientIdError): client.request_refund(trans_ref=get_random_string(), phone="22991617451")
def test_request_refund_unauthorized_response(client: Client, httpx_mock: HTTPXMock): url = client.context + REFUND_PATH httpx_mock.add_response(url=url, method="POST", status_code=httpx.codes.UNAUTHORIZED) with pytest.raises(InvalidCredentialsError): client.request_refund(trans_ref=get_random_string(), phone="22991617451")
def test_request_refund_rejected(client: Client, httpx_mock: HTTPXMock): url = client.context + REFUND_PATH httpx_mock.add_response(url=url, method="POST", status_code=httpx.codes.BAD_REQUEST) result = client.request_refund(trans_ref=get_random_string(), phone="22991617451") assert result.state == OPERATION_REJECTED
def test_request_refund_bad_provider(client: Client, httpx_mock: HTTPXMock): with pytest.raises(AssertionError): client.request_refund(trans_ref=get_random_string(), phone="22963588213")