def test_list_baduuid(self): exc = compat.HTTPError("", 400, "", "", _common.StringIO.StringIO("")) self.opener = _common.FakeOpener( exception=musicbrainzngs.ResponseError(cause=exc)) musicbrainzngs.compat.build_opener = lambda *args: self.opener try: res = caa.get_image_list("8ec178f4-a8e8-4f22-bcba-19644XXXXXX") self.assertTrue(False, "Expected an exception") except musicbrainzngs.ResponseError as e: self.assertEqual(e.cause.code, 400)
def test_no_collection(self): """ If a collection doesn't exist, you get a 404 """ exc = compat.HTTPError("", 404, "", "", _common.StringIO.StringIO("")) self.opener = _common.FakeOpener(exception=musicbrainzngs.ResponseError(cause=exc)) musicbrainzngs.compat.build_opener = lambda *args: self.opener try: res = musicbrainzngs.get_releases_in_collection("17905fdb-102d-40f0-91d3-eabcabc64f44") self.assertTrue(False, "Expected an exception") except musicbrainzngs.ResponseError as e: self.assertEqual(e.cause.code, 404)