Exemple #1
0
def test_send_request_get_201_response(mocker):
    drip_client = create_drip_client()
    mocker.patch.object(requests, 'get')
    requests.get.return_value = return_response(201)
    assert drip_client.send_request(request_url=TestConstants.test_request_url,
                                    method="GET") == {}
    assert requests.get.call_count == 1
    requests.get.assert_called_with(TestConstants.test_request_url,
                                    auth=('test_token', ''),
                                    params={})
Exemple #2
0
def test_send_request_default_201_response(mocker):
    drip_client = create_drip_client()
    mocker.patch.object(requests, 'post')
    requests.post.return_value = return_response(201)
    assert drip_client.send_request(
        request_url=TestConstants.test_request_url) == {}
    assert requests.post.call_count == 1
    requests.post.assert_called_with(TestConstants.test_request_url,
                                     auth=('test_token', ''),
                                     data=json.dumps({}),
                                     headers=TestConstants.test_headers)