diff --git a/swh/web/tests/api/test_apidoc.py b/swh/web/tests/api/test_apidoc.py index 7ba43c283c4dfbb7e026ec8ab9bcd9d116bacb9c..c90800360ee061060d05e204f393f7ac78d377ff 100644 --- a/swh/web/tests/api/test_apidoc.py +++ b/swh/web/tests/api/test_apidoc.py @@ -83,7 +83,7 @@ class APIDocTestCase(WebTestCase, APITestCase): rv = self.client.get('/api/1/some/doc/route/') # then - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertTemplateUsed('api/apidoc.html') def test_apidoc_route_fn(self): @@ -92,7 +92,7 @@ class APIDocTestCase(WebTestCase, APITestCase): rv = self.client.get('/api/1/some/1/1/') # then - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) @staticmethod @api_route(r'/some/full/(?P<myarg>[0-9]+)/(?P<myotherarg>[0-9]+)/', @@ -109,7 +109,7 @@ class APIDocTestCase(WebTestCase, APITestCase): rv = self.client.get('/api/1/some/complete/doc/route/') # then - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertTemplateUsed('api/apidoc.html') def test_apidoc_full_stack_fn(self): @@ -117,7 +117,7 @@ class APIDocTestCase(WebTestCase, APITestCase): rv = self.client.get('/api/1/some/full/1/1/') # then - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) def test_api_doc_parse_httpdomain(self): doc_data = { diff --git a/swh/web/tests/api/test_apiresponse.py b/swh/web/tests/api/test_apiresponse.py index 21d295f96e954a485cf4234c3c819f633d891c53..74702de88cb9e26565bab139d3cc130e33c0e594 100644 --- a/swh/web/tests/api/test_apiresponse.py +++ b/swh/web/tests/api/test_apiresponse.py @@ -131,7 +131,7 @@ class RendererTestCase(WebTestCase): # then mock_filter.assert_called_with(request, data) self.assertEqual(rv.data, expected_data) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) if mime_type == 'text/html': self.assertEqual(rv.template_name, 'api/apidoc.html') diff --git a/swh/web/tests/api/views/test_content.py b/swh/web/tests/api/views/test_content.py index 6aff75f96c23a1dd5ff806e18957e19076c79ef4..5f3721091565b8c3bdb04420f59448c8edfb1138 100644 --- a/swh/web/tests/api/views/test_content.py +++ b/swh/web/tests/api/views/test_content.py @@ -28,7 +28,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1_git:%s' % content['sha1_git']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') content_url = reverse('api-1-content', url_args={'q': 'sha1:%s' % content['sha1']}) @@ -43,7 +43,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1:%s' % unknown_content_['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -60,7 +60,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1_git:%s' % content['sha1_git']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') content_url = reverse('api-1-content', url_args={'q': 'sha1:%s' % content['sha1']}) @@ -75,7 +75,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1:%s' % unknown_content_['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -101,7 +101,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): query_params={'per_page': 100}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') for entry in rv.data: content_sha1 = entry['sha1'] @@ -135,7 +135,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-content-symbol', url_args={'q': 'bar'}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -153,7 +153,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1_git:%s' % content['sha1_git']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') content_url = reverse('api-1-content', url_args={'q': 'sha1:%s' % content['sha1']}) @@ -172,7 +172,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1_git:%s' % content['sha1_git']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') content_url = reverse('api-1-content', url_args={'q': 'sha1:%s' % content['sha1']}) @@ -187,7 +187,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1:%s' % unknown_content_['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -201,7 +201,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-content', {'q': 'sha1:%s' % content['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') expected_data = self.content_get_metadata(content['sha1']) for key, view_name in (('data_url', 'api-1-content-raw'), @@ -219,7 +219,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-content', url_args={'q': 'sha1:%s' % unknown_content_['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -234,7 +234,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha256:%s' % unknown_content_['sha256']}) rv = self.client.get(url, HTTP_ACCEPT='application/yaml') - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertTrue('application/yaml' in rv['Content-Type']) self.assertEqual(rv.data, { @@ -250,7 +250,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': 'sha1:%s' % unknown_content_['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -301,7 +301,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': content['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { @@ -321,7 +321,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': content['sha1']}) rv = self.client.get(url, HTTP_ACCEPT='application/yaml') - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/yaml') self.assertEqual(rv.data, { @@ -346,7 +346,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): HTTP_ACCEPT='application/yaml' ) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertTrue('application/yaml' in rv['Content-Type']) self.assertEqual(rv.data, { 'search_res': [ @@ -365,7 +365,7 @@ class ContentApiTestCase(WebTestCase, APITestCase): url_args={'q': unknown_content_['sha1']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'search_res': [ diff --git a/swh/web/tests/api/views/test_directory.py b/swh/web/tests/api/views/test_directory.py index 621280fdd82c0d34edb57257c05ce2469f89e058..8bc57df4c677917bfd682a8451c46778835d3ce7 100644 --- a/swh/web/tests/api/views/test_directory.py +++ b/swh/web/tests/api/views/test_directory.py @@ -22,7 +22,7 @@ class DirectoryApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-directory', url_args={'sha1_git': directory}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') expected_data = list(map(self._enrich_dir_data, @@ -37,7 +37,7 @@ class DirectoryApiTestCase(WebTestCase, APITestCase): url_args={'sha1_git': unknown_directory_}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -55,7 +55,7 @@ class DirectoryApiTestCase(WebTestCase, APITestCase): 'path': path['name']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, self._enrich_dir_data(path)) @@ -68,7 +68,7 @@ class DirectoryApiTestCase(WebTestCase, APITestCase): 'path': path}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', diff --git a/swh/web/tests/api/views/test_identifiers.py b/swh/web/tests/api/views/test_identifiers.py index 5dbe36f7f8f720338949ce22c2f788281bea74d7..d6f5059ce9e030605b0667d1a2f87f3a292e06eb 100644 --- a/swh/web/tests/api/views/test_identifiers.py +++ b/swh/web/tests/api/views/test_identifiers.py @@ -58,7 +58,7 @@ class SwhIdsApiTestCase(WebTestCase, APITestCase): 'scheme_version': 1 } - self.assertEqual(resp.status_code, 200) + self.assertEqual(resp.status_code, 200, resp.data) self.assertEqual(resp.data, expected_result) def test_swh_id_resolve_invalid(self): @@ -68,7 +68,7 @@ class SwhIdsApiTestCase(WebTestCase, APITestCase): resp = self.client.get(url) - self.assertEqual(resp.status_code, 400) + self.assertEqual(resp.status_code, 400, resp.data) @given(unknown_content(), unknown_directory(), unknown_release(), unknown_revision(), unknown_snapshot()) @@ -88,4 +88,4 @@ class SwhIdsApiTestCase(WebTestCase, APITestCase): resp = self.client.get(url) - self.assertEqual(resp.status_code, 404) + self.assertEqual(resp.status_code, 404, resp.data) diff --git a/swh/web/tests/api/views/test_origin.py b/swh/web/tests/api/views/test_origin.py index 3bdcdc5d1db1a10337f0e50ab283bb5a0beefbd9..8e2a61f2bbf5531136b3ac9e82c504847db44ac3 100644 --- a/swh/web/tests/api/views/test_origin.py +++ b/swh/web/tests/api/views/test_origin.py @@ -33,7 +33,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-origin-visits', url_args={'origin_id': 2}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 400) + self.assertEqual(rv.status_code, 400, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'ValueError', @@ -50,7 +50,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-origin-visits', url_args={'origin_id': 2}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 503) + self.assertEqual(rv.status_code, 503, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'StorageDBError', @@ -68,7 +68,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-origin-visits', url_args={'origin_id': 2}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 503) + self.assertEqual(rv.status_code, 503, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'StorageAPIError', @@ -100,7 +100,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') for expected_visit in expected_visits: @@ -132,7 +132,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): 'visit_id': visit_id}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') expected_visit = self.origin_visit_get_by(origin_id, visit_id) @@ -161,7 +161,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -183,7 +183,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): expected_origin['origin_visits_url'] = origin_visits_url - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_origin) @@ -202,7 +202,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): expected_origin['origin_visits_url'] = origin_visits_url - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_origin) @@ -214,7 +214,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): 'origin_url': new_origin['url']}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -386,7 +386,7 @@ class OriginApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) start = origin_from_idx end = origin_from_idx + origin_count diff --git a/swh/web/tests/api/views/test_person.py b/swh/web/tests/api/views/test_person.py index e00c36ed8087fd7f76d11b9fcf14d73e6b328612..6b98f066e8c5ac602fa0a4b737cc75e3dc5c40fd 100644 --- a/swh/web/tests/api/views/test_person.py +++ b/swh/web/tests/api/views/test_person.py @@ -24,7 +24,7 @@ class PersonApiTestCase(WebTestCase, APITestCase): expected_person = self.person_get(person) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_person) @@ -35,7 +35,7 @@ class PersonApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', diff --git a/swh/web/tests/api/views/test_release.py b/swh/web/tests/api/views/test_release.py index 7aca0417a215846a92a41107546371973f79a5ae..3233e8497f909df1e1867c3b0de47229800979da 100644 --- a/swh/web/tests/api/views/test_release.py +++ b/swh/web/tests/api/views/test_release.py @@ -35,7 +35,7 @@ class ReleaseApiTestCase(WebTestCase, APITestCase): expected_release['author_url'] = author_url expected_release['target_url'] = target_url - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_release) @@ -93,7 +93,7 @@ class ReleaseApiTestCase(WebTestCase, APITestCase): expected_release['author_url'] = author_url expected_release['target_url'] = target_url - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_release) @@ -104,7 +104,7 @@ class ReleaseApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', diff --git a/swh/web/tests/api/views/test_revision.py b/swh/web/tests/api/views/test_revision.py index 457d61be73947b39d540f50139340eecf46bf97e..fb45b28297f59612e6ec127a193361fcfec9a06c 100644 --- a/swh/web/tests/api/views/test_revision.py +++ b/swh/web/tests/api/views/test_revision.py @@ -33,7 +33,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): self._enrich_revision(expected_revision) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_revision) @@ -44,7 +44,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): url_args={'sha1_git': unknown_revision_}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -77,7 +77,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -91,7 +91,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): url_args={'sha1_git': unknown_revision_}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -105,7 +105,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): url_args={'origin_id': unknown_origin_id_}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -125,7 +125,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): self._enrich_revision(expected_revision) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_revision) @@ -149,7 +149,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): self._enrich_revision(expected_revision) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_revision) @@ -176,7 +176,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): self._enrich_revision(expected_revision) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_revision) @@ -207,7 +207,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): self._enrich_revision(expected_revision) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_revision) @@ -218,7 +218,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): url_args={'origin_id': unknown_origin_id_}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -274,7 +274,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): 'type': 'dir' } - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_result) @@ -293,7 +293,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): has_next = len(expected_log) > per_page - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_log[:-1] if has_next else expected_log) @@ -314,7 +314,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -344,7 +344,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): expected_log.insert(0, prev_revision) expected_log = list(map(self._enrich_revision, expected_log)) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_log) @@ -368,7 +368,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): has_next = len(expected_log) > per_page - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_log[:-1] if has_next else expected_log) @@ -393,7 +393,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertFalse(rv.has_header('Link')) self.assertEqual( @@ -410,7 +410,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): # then rv = self.client.get('/api/1/revision/999/directory/some/path/to/dir/') - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'NotFoundExc', @@ -454,7 +454,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): # then rv = self.client.get('/api/1/revision/999/directory/some/path/') - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, stub_dir) @@ -483,7 +483,7 @@ class RevisionApiTestCase(WebTestCase, APITestCase): url = '/api/1/revision/666/directory/some/other/path/' rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, stub_content) diff --git a/swh/web/tests/api/views/test_snapshot.py b/swh/web/tests/api/views/test_snapshot.py index c2330352ab1442c38d478796e56a0bf33417ee44..a1fb0b3ac9a4c458c9a8a9aeb9fa4f526929b31a 100644 --- a/swh/web/tests/api/views/test_snapshot.py +++ b/swh/web/tests/api/views/test_snapshot.py @@ -26,7 +26,7 @@ class SnapshotApiTestCase(WebTestCase, APITestCase): url_args={'snapshot_id': snapshot}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') expected_data = self.snapshot_get(snapshot) expected_data = self._enrich_snapshot(expected_data) @@ -56,7 +56,7 @@ class SnapshotApiTestCase(WebTestCase, APITestCase): query_params={'branches_from': branches_from, 'branches_count': branches_count}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') expected_data = self.snapshot_get_branches(snapshot, branches_from, branches_count) @@ -87,7 +87,7 @@ class SnapshotApiTestCase(WebTestCase, APITestCase): url_args={'snapshot_id': snapshot}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, whole_snapshot) @@ -114,7 +114,7 @@ class SnapshotApiTestCase(WebTestCase, APITestCase): snapshot, target_types=target_type) expected_data = self._enrich_snapshot(expected_data) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, expected_data) @@ -124,12 +124,12 @@ class SnapshotApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-snapshot', url_args={'snapshot_id': '63ce369'}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 400) + self.assertEqual(rv.status_code, 400, rv.data) url = reverse('api-1-snapshot', url_args={'snapshot_id': unknown_snapshot_}) rv = self.client.get(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) def _enrich_snapshot(self, snapshot): def _get_branch_url(target_type, target): diff --git a/swh/web/tests/api/views/test_stat.py b/swh/web/tests/api/views/test_stat.py index 3124dad13f59c0a1b3f2dc18aec7a7e2a7c1007b..1e8ba052640804209a68db6f01bab0e6b08748d4 100644 --- a/swh/web/tests/api/views/test_stat.py +++ b/swh/web/tests/api/views/test_stat.py @@ -22,7 +22,7 @@ class StatApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-stat-counters') rv = self.client.get(url) - self.assertEqual(rv.status_code, 400) + self.assertEqual(rv.status_code, 400, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'ValueError', @@ -37,7 +37,7 @@ class StatApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-stat-counters') rv = self.client.get(url) - self.assertEqual(rv.status_code, 503) + self.assertEqual(rv.status_code, 503, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'StorageDBError', @@ -55,7 +55,7 @@ class StatApiTestCase(WebTestCase, APITestCase): url = reverse('api-1-stat-counters') rv = self.client.get(url) - self.assertEqual(rv.status_code, 503) + self.assertEqual(rv.status_code, 503, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, { 'exception': 'StorageAPIError', @@ -70,6 +70,6 @@ class StatApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, self.storage.stat_counters()) diff --git a/swh/web/tests/api/views/test_vault.py b/swh/web/tests/api/views/test_vault.py index a856a157c8bb6d89f9f727aab813267270e0f785..0548f4083a94d2b7547cdab383c498b22d9ae409 100644 --- a/swh/web/tests/api/views/test_vault.py +++ b/swh/web/tests/api/views/test_vault.py @@ -39,7 +39,7 @@ class VaultApiTestCase(WebTestCase, APITestCase): url += '{}/'.format(obj_type_format) rv = self.client.post(url, {'email': 'test@test.mail'}) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, stub_cook) @@ -78,7 +78,7 @@ class VaultApiTestCase(WebTestCase, APITestCase): url += '{}/'.format(obj_type_format) rv = self.client.post(url, {'email': 'test@test.mail'}) - self.assertEqual(rv.status_code, 200) + self.assertEqual(rv.status_code, 200, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data, stub_cook) @@ -106,7 +106,7 @@ class VaultApiTestCase(WebTestCase, APITestCase): url += '{}/'.format(obj_type_format) rv = self.client.post(url) - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data['exception'], 'NotFoundExc') @@ -115,7 +115,7 @@ class VaultApiTestCase(WebTestCase, APITestCase): rv = self.client.get(url + 'raw/') - self.assertEqual(rv.status_code, 404) + self.assertEqual(rv.status_code, 404, rv.data) self.assertEqual(rv['Content-Type'], 'application/json') self.assertEqual(rv.data['exception'], 'NotFoundExc') mock_service.vault_fetch.assert_called_with(