Skip to content

Commit

Permalink
Merge pull request #874 from karlcow/856/1
Browse files Browse the repository at this point in the history
Fix #856 - Send the right content to rate_limit route
  • Loading branch information
Mike Taylor committed Dec 16, 2015
2 parents 4542045 + 57935fa commit ee0dc98
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/test_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ def test_tools_cssfixme(self):
rv = self.app.get('/tools/cssfixme')
self.assertEqual(rv.status_code, 200)

def test_rate_limit(self):
'''Test that we are receiving the appropriate text file.'''
rv = self.app.get('/rate_limit')
response_start = 'Current user:'
self.assertEqual(rv.status_code, 200)
self.assertTrue = rv.data.startswith(response_start)

if __name__ == '__main__':
unittest.main()
3 changes: 2 additions & 1 deletion webcompat/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ def show_user_page(username):

@app.route('/rate_limit')
def show_rate_limit():
rl = json.loads(get_rate_limit())
body, status_code, response_headers = get_rate_limit()
rl = json.loads(body)
if g.user:
rl.update({"user": session.get('username')})
else:
Expand Down

0 comments on commit ee0dc98

Please sign in to comment.