Esempio n. 1
0
def test_fail_replace_event():
    responses.add(responses.PUT,
                  'https://api.courier.com/events/1234',
                  status=400,
                  content_type='application/json',
                  body='{"message": "An error occured"}')

    c = Courier(auth_token='123456789ABCDF')

    with pytest.raises(CourierAPIException):
        c.replace_event("1234", notification_id="notification-id-1")
Esempio n. 2
0
def test_success_replace_event():
    responses.add(responses.PUT,
                  'https://api.courier.com/events/1234',
                  status=200,
                  content_type='application/json',
                  body='{"id": "notification-id-1", "type": "notification"}')

    c = Courier(auth_token='123456789ABCDF')
    r = c.replace_event("1234", notification_id="notification-id-1")

    assert r == {"id": "notification-id-1", "type": "notification"}