def test_request_delete_does_not_raise_exception_if_successful(): responses.add( responses.DELETE, BASE_URL, status=204, content_type="application/json" ) api = TwitchAPI(client_id="client") api._request_delete("")
def test_request_delete_raises_exception_if_not_200_response(status): responses.add( responses.DELETE, BASE_URL, status=status, content_type="application/json" ) api = TwitchAPI(client_id="client") with pytest.raises(exceptions.HTTPError): api._request_delete("")
def test_request_delete_sends_headers_with_the_request(): responses.add( responses.DELETE, BASE_URL, status=204, content_type="application/json" ) api = TwitchAPI(client_id="client") api._request_delete("") assert "Client-ID" in responses.calls[0].request.headers assert "Accept" in responses.calls[0].request.headers
def test_request_delete_sends_headers_with_the_request(): responses.add(responses.DELETE, BASE_URL, status=204, content_type='application/json') api = TwitchAPI(client_id='client') api._request_delete('') assert 'Client-ID' in responses.calls[0].request.headers assert 'Accept' in responses.calls[0].request.headers
def test_request_delete_does_not_raise_exception_if_successful_and_returns_json( ): responses.add(responses.DELETE, BASE_URL, body=json.dumps(dummy_data), status=200, content_type='application/json') api = TwitchAPI(client_id='client') response = api._request_delete('') assert response == dummy_data