Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,13 @@ def test_api_raises_exception_with_if_data_status_is_false(self, request_mock):
ubersmith_api = ubersmith_client.api.init(self.url, self.username, self.password)

self.expect_a_ubersmith_call(request_mock, method="client.miss", data=data)
assert_that(calling(ubersmith_api.client.miss), raises(ubersmith_client.exceptions.UbersmithException))

with self.assertRaises(ubersmith_client.exceptions.UbersmithException) as cm:
ubersmith_api.client.miss()

catched_exception = cm.exception
assert_that(catched_exception.code, equal_to(1))
assert_that(catched_exception.message, equal_to('invalid method specified: client.miss'))

@requests_mock.mock()
def test_api_raises_exception_for_invalid_status_code(self, request_mock):
Expand Down
4 changes: 2 additions & 2 deletions ubersmith_client/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def process_request(self, http_method, **kwargs):
response_json = response.json()
if not response_json['status']:
raise UbersmithException(
500,
"error {0}, {1}".format(response_json['error_code'], response_json['error_message'])
response_json['error_code'],
response_json['error_message']
)

return response.json()["data"]
Expand Down