mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-25 16:54:03 -04:00
add tests for service_api_client
This commit is contained in:
@@ -325,7 +325,7 @@ def register_errorhandlers(application):
|
|||||||
@application.errorhandler(HTTPError)
|
@application.errorhandler(HTTPError)
|
||||||
def render_http_error(error):
|
def render_http_error(error):
|
||||||
application.logger.error("API {} failed with status {} message {}".format(
|
application.logger.error("API {} failed with status {} message {}".format(
|
||||||
error.response.url,
|
error.response.url if error.response else 'unknown',
|
||||||
error.status_code,
|
error.status_code,
|
||||||
error.message
|
error.message
|
||||||
))
|
))
|
||||||
|
|||||||
@@ -19,3 +19,19 @@ def test_client_posts_archived_true_when_deleting_template(mocker):
|
|||||||
|
|
||||||
client.delete_service_template(service_id, template_id)
|
client.delete_service_template(service_id, template_id)
|
||||||
mock_post.assert_called_once_with(expected_url, data=expected_data)
|
mock_post.assert_called_once_with(expected_url, data=expected_data)
|
||||||
|
|
||||||
|
|
||||||
|
def test_client_gets_service_with_no_params(mocker):
|
||||||
|
client = ServiceAPIClient()
|
||||||
|
mock_post = mocker.patch('app.notify_client.service_api_client.ServiceAPIClient.get')
|
||||||
|
|
||||||
|
client.get_service('foo')
|
||||||
|
mock_post.assert_called_once_with('/service/foo', params={})
|
||||||
|
|
||||||
|
|
||||||
|
def test_client_gets_service_with_detailed_params(mocker):
|
||||||
|
client = ServiceAPIClient()
|
||||||
|
mock_post = mocker.patch('app.notify_client.service_api_client.ServiceAPIClient.get')
|
||||||
|
|
||||||
|
client.get_detailed_service('foo')
|
||||||
|
mock_post.assert_called_once_with('/service/foo', params={'detailed': True})
|
||||||
|
|||||||
Reference in New Issue
Block a user