def test_fail_replace_brand(): responses.add(responses.PUT, 'https://api.courier.com/brands/1234', status=400, content_type='application/json', body='{"message": "An error occured"}') c = Courier(auth_token='123456789ABCDF') with pytest.raises(CourierAPIException): c.replace_brand("1234", name="my brand", settings={})
def test_success_replace_brand(): responses.add(responses.PUT, 'https://api.courier.com/brands/1234', status=200, content_type='application/json', body='{"id": "1234", "name": "my brand"}') c = Courier(auth_token='123456789ABCDF') r = c.replace_brand("1234", name="my brand", settings={}) assert r == {"id": "1234", "name": "my brand"}
def test_success_replace_brand_with_options(): responses.add(responses.PUT, 'https://api.courier.com/brands/1234', status=200, content_type='application/json', body='{"id": "1234", "name": "my brand"}') c = Courier(auth_token='123456789ABCDF') r = c.replace_brand("1234", name="my brand", settings={}, snippets={ 'format': 'handlebars', 'name': 'test', 'value': '{{test}}' }) assert r == {"id": "1234", "name": "my brand"}