mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-25 03:30:53 -04:00
add tests for service_api_client
This commit is contained in:
@@ -325,7 +325,7 @@ def register_errorhandlers(application):
|
||||
@application.errorhandler(HTTPError)
|
||||
def render_http_error(error):
|
||||
application.logger.error("API {} failed with status {} message {}".format(
|
||||
error.response.url,
|
||||
error.response.url if error.response else 'unknown',
|
||||
error.status_code,
|
||||
error.message
|
||||
))
|
||||
|
||||
@@ -19,3 +19,19 @@ def test_client_posts_archived_true_when_deleting_template(mocker):
|
||||
|
||||
client.delete_service_template(service_id, template_id)
|
||||
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