Skip to content

Commit

Permalink
Added test for Not Found (404) responses
Browse files Browse the repository at this point in the history
  • Loading branch information
mschwager committed Nov 29, 2016
1 parent 1395343 commit 8504d0d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/mocked_api_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,14 @@
requests.codes.FORBIDDEN,
]

NOT_FOUND_RESULT = [
{
"message": "Not Found",
"documentation_url": "https://developer.github.com/v3",
},
requests.codes.NOT_FOUND,
]


def get_result_value(result):
return result[0]
Expand Down
12 changes: 12 additions & 0 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ def test_maximum_bad_credentials(self):

self.assertTrue(e.exception.forbidden)

def test_not_found(self):
will_return = mocked_api_results.NOT_FOUND_RESULT

mocked_api = self.api_will_return(*will_return)

# The API call we make doesn't matter, it will return the same result
# no matter what
with self.assertRaises(api.ApiCallException) as e:
mocked_api.get_public_organization("unused")

self.assertTrue(e.exception.not_found)

def test_authenticated_endpoint_ok(self):
will_return = mocked_api_results.STANDARD_API_RESULT

Expand Down

0 comments on commit 8504d0d

Please sign in to comment.