Beispiel #1
0
def test_ResourceNotFound_categories_with_suppressed_error():
    Client.config({'suppress_http_errors': True})
    client = Client('test_id', 'test_secret')
    response = client.category('pnc')
    assert response.status_code == 404
    assert (
      json.loads(response.content)['message'] == 'unable to find category'
    )
Beispiel #2
0
def test_ResourceNotFound_categories_with_suppressed_error():
    Client.config({'suppress_http_errors': True})
    client = Client('test_id', 'test_secret')
    response = client.category('pnc')
    assert response.status_code == 404
    assert (
        to_json(response)['message'] == 'unable to find category'
    )
Beispiel #3
0
def test_ResourceNotFound_categories():
    client = Client('test_id', 'test_secret')
    with pytest.raises(ResourceNotFoundError):
        client.category('pnc')
Beispiel #4
0
def test_category():
    client = Client('test_id', 'test_secret')
    response = client.category(client.categories().json()[0]['id'])
    assert response.status_code == 200
def test_category():
    with patch('requests.get') as mock_requests_get:
        client = Client('myclientid', 'mysecret')
        client.category(1)
        assert mock_requests_get.called
Beispiel #6
0
def test_ResourceNotFound_categories():
    client = Client('test_id', 'test_secret')
    with pytest.raises(ResourceNotFoundError):
      client.category('pnc')
Beispiel #7
0
def test_category():
    client = Client('test_id', 'test_secret')
    response = client.category(client.categories().json()[0]['id'])
    assert response.status_code == 200