Skip to content

Commit

Permalink
Add a test that checks links on APIs linked from root
Browse files Browse the repository at this point in the history
This test clicks on each link on API root and checks that rendering the
documentation there does not log any errors. This is not perfect in that
views not listed on API root will not be tested.
  • Loading branch information
lubomir committed Aug 19, 2015
1 parent bbc33e6 commit 456c3f2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pdc/apps/common/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,3 +420,12 @@ def test_filter_set_has_details(self):
' * `key_id` (string)\n'
' * `name` (string)'
)


class AutoUrlsTestCase(APITestCase):
def test_no_autolink_logs_error(self):
root = self.client.get(reverse('api-root'))
for _, url in root.data.iteritems():
with mock.patch('logging.getLogger') as getLogger:
self.client.get(url, HTTP_ACCEPT='text/html')
self.assertFalse(getLogger.return_value.error.called, "%s has bad link" % url)

0 comments on commit 456c3f2

Please sign in to comment.