コード例 #1
0
def test_response_to_json_no_error():
    raw_response = _create_mock_response({'key': 'value'}, None)
    assert _response_to_json(raw_response) == {'key': 'value'}
コード例 #2
0
def test_response_to_json_parsing_error():
    raw_response = mock.MagicMock()
    raw_response.json.side_effect = ValueError('Invalid json')
    with pytest.raises(CivisClientError) as excinfo:
        _response_to_json(raw_response)
    assert 'Unable to parse JSON from response' in str(excinfo.value)
コード例 #3
0
def test_response_to_json_no_error():
    raw_response = mock.MagicMock()
    raw_response.json.return_value = {'key': 'value'}
    assert _response_to_json(raw_response) == {'key': 'value'}