Skip to content

Commit

Permalink
Issue #1329. Add URL tests for new report endpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Taylor committed Feb 28, 2017
1 parent b727f7d commit 1476981
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,19 @@ def test_labeler_webhook(self):
# A random post should 401, only requests from GitHub will 200
self.assertEqual(rv.status_code, 401)

def test_csp_report_uri(self):
'''Test POST to /csp-report w/ correct content-type returns 204.'''
headers = {'Content-Type': 'application/csp-report'}
rv = self.app.post('/csp-report', headers=headers)
self.assertEqual(rv.status_code, 204)

def test_csp_report_uri_bad_content_type(self):
'''Test POST w/ wrong content-type to /csp-report returns 400.'''
headers = {'Content-Type': 'application/json'}
rv = self.app.post('/csp-report', headers=headers)
self.assertNotEqual(rv.status_code, 204)
self.assertEqual(rv.status_code, 400)

def test_tools_cssfixme(self):
'''Test that the /tools/cssfixme route gets 200.'''
rv = self.app.get('/tools/cssfixme')
Expand Down

0 comments on commit 1476981

Please sign in to comment.