Exemple #1
0
def test_fail_get_brand():
    responses.add(responses.GET,
                  'https://api.courier.com/brands/1234',
                  status=400,
                  content_type='application/json',
                  body='{"message": "An error occurred"}')

    c = Courier(auth_token='123456789ABCDF')

    with pytest.raises(CourierAPIException):
        c.get_brand(brand_id='1234')
Exemple #2
0
def test_success_get_brand():
    responses.add(responses.GET,
                  'https://api.courier.com/brands/1234',
                  status=200,
                  content_type='application/json',
                  body='{"status": "DELIVERED"}')

    c = Courier(auth_token='123456789ABCDF')
    r = c.get_brand(brand_id='1234')

    assert r == {"status": "DELIVERED"}