Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Issue #1058 - Tests to check link header in response for github api /…
…issues/<issue_number>/comments
  • Loading branch information
deepthivenkat committed Aug 1, 2016
commit 385ddadd51c2b9fc88dd9058bf42a1e75563e327
13 changes: 13 additions & 0 deletions tests/test_api_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,19 @@ def test_api_labels_without_auth(self):
self.assertEqual(rv.status_code, 200)
self.assertEqual(rv.content_type, 'application/json')

def test_api_comments_link_header_auth(self):
'''API access to comments greater than 30 returns pagination in Link header of the response.'''
query_string = {'callback': 'foo'}

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

rv = self.app.get('/api/issues/398/comments', query_string=query_string, environ_base=headers)
self.assertTrue = all(x in rv.data for x in ['Link', 'rel', 'next', 'last', 'page'])
self.assertEqual(rv.status_code, 200)
self.assertEqual(rv.content_type, 'application/json')
'''API access to comments less than 30 does not return any link header in the response.'''
rv = self.app.get('/api/issues/4/comments', query_string=query_string, environ_base=headers)
self.assertTrue = not all(x in rv.data for x in ['Link', 'rel', 'next', 'last', 'page'])
self.assertEqual(rv.status_code, 200)
self.assertEqual(rv.content_type, 'application/json')

def test_api_set_labels_without_auth(self):
'''API setting labels without auth returns JSON 403 error code.'''
rv = self.app.post('/api/issues/1/labels',
Expand Down