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

    c = Courier(auth_token='123456789ABCDF')

    with pytest.raises(CourierAPIException):
        c.get_brands()
Example #2
0
def test_success_get_brands_with_params():
    responses.add(responses.GET,
                  'https://api.courier.com/brands?cursor=ABCD1234',
                  status=200,
                  content_type='application/json',
                  body='{"paging": {}, "results": []}')

    c = Courier(auth_token='123456789ABCDF')
    r = c.get_brands(cursor="ABCD1234")

    assert r == {"paging": {}, "results": []}
Example #3
0
def test_success_get_brands():
    responses.add(responses.GET,
                  'https://api.trycourier.app/brands',
                  status=200,
                  content_type='application/json',
                  body='{"paging": {}, "results": []}')

    c = Courier(auth_token='123456789ABCDF')
    r = c.get_brands()

    assert r == {"paging": {}, "results": []}