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

    c = Courier(auth_token='123456789ABCDF')

    with pytest.raises(CourierAPIException):
        c.get_message(message_id='1234', )
Beispiel #2
0
def test_success_get_message():
    responses.add(responses.GET,
                  'https://api.courier.com/messages/1234',
                  status=200,
                  content_type='application/json',
                  body='{"status": "DELIVERED"}')

    c = Courier(auth_token='123456789ABCDF')
    r = c.get_message(message_id='1234', )

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