Fix a couple of unit tests
This commit is contained in:
parent
639836c248
commit
b4861e4332
2 changed files with 3 additions and 6 deletions
|
@ -39,7 +39,6 @@ class TestAlbumsList(TestAlbums):
|
||||||
self.assertEqual(result[1].id, "2")
|
self.assertEqual(result[1].id, "2")
|
||||||
self.assertEqual(result[1].name, "Album 2")
|
self.assertEqual(result[1].name, "Album 2")
|
||||||
|
|
||||||
@unittest.expectedFailure
|
|
||||||
@mock.patch.object(openphoto.OpenPhoto, 'get')
|
@mock.patch.object(openphoto.OpenPhoto, 'get')
|
||||||
def test_albums_list_returns_cover_photos(self, mock_get):
|
def test_albums_list_returns_cover_photos(self, mock_get):
|
||||||
"""Check that the album list returns cover photo objects"""
|
"""Check that the album list returns cover photo objects"""
|
||||||
|
@ -52,7 +51,7 @@ class TestAlbumsList(TestAlbums):
|
||||||
self.assertEqual(result[0].cover.id, "1a")
|
self.assertEqual(result[0].cover.id, "1a")
|
||||||
self.assertEqual(result[0].cover.tags, ["tag1", "tag2"])
|
self.assertEqual(result[0].cover.tags, ["tag1", "tag2"])
|
||||||
self.assertEqual(result[1].id, "2")
|
self.assertEqual(result[1].id, "2")
|
||||||
self.assertEqual(result[0].name, "Album 2")
|
self.assertEqual(result[1].name, "Album 2")
|
||||||
self.assertEqual(result[1].cover.id, "2b")
|
self.assertEqual(result[1].cover.id, "2b")
|
||||||
self.assertEqual(result[1].cover.tags, ["tag3", "tag4"])
|
self.assertEqual(result[1].cover.tags, ["tag3", "tag4"])
|
||||||
|
|
||||||
|
|
|
@ -174,16 +174,14 @@ class TestHttpErrors(unittest.TestCase):
|
||||||
response = self.client.get(self.test_endpoint)
|
response = self.client.get(self.test_endpoint)
|
||||||
self.assertEqual(response["code"], 202)
|
self.assertEqual(response["code"], 202)
|
||||||
|
|
||||||
# TODO: Status code mismatch should raise an exception
|
|
||||||
@unittest.expectedFailure
|
|
||||||
@httpretty.activate
|
@httpretty.activate
|
||||||
def test_post_with_status_code_mismatch(self):
|
def test_post_with_status_code_mismatch(self):
|
||||||
"""
|
"""
|
||||||
Check that a mismatched HTTP status code still returns the
|
Check that a mismatched HTTP status code still returns the
|
||||||
JSON status code for post requests.
|
JSON status code for post requests.
|
||||||
"""
|
"""
|
||||||
data = {"message": "Test Message", "code": 200}
|
data = {"message": "Test Message", "code": 202}
|
||||||
self._register_uri(httpretty.POST, data=data, status=202)
|
self._register_uri(httpretty.POST, data=data, status=200)
|
||||||
response = self.client.post(self.test_endpoint)
|
response = self.client.post(self.test_endpoint)
|
||||||
self.assertEqual(response["code"], 202)
|
self.assertEqual(response["code"], 202)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue