Skip to content

Commit

Permalink
Merge pull request #1727 from karlcow/1428/2
Browse files Browse the repository at this point in the history
Fixes #1428 - Adds test for activity page
  • Loading branch information
karlcow authored Aug 29, 2017
2 parents 93d9472 + a54c1e7 commit dd8102a
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions tests/test_rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

'''Tests for our URI endpoints' rendering.'''
"""Tests for our URI endpoints' rendering."""

import os.path
import sys
Expand All @@ -20,16 +20,27 @@
'rv:31.0) Gecko/20100101 Firefox/31.0')}


class TestURLs(unittest.TestCase):
class TestURIContent(unittest.TestCase):
"""Tests for the content once HTML templates are rendered."""

def setUp(self):
"""Set up the tests."""
webcompat.app.config['TESTING'] = True
self.app = webcompat.app.test_client()

def tearDown(self):
"""Tear down the tests."""
pass

def login(self, username, password):
"""Create a call to the login page to initiate g."""
return self.app.get('/login', data=dict(
username=username,
password=password
), follow_redirects=True)

def test_titles(self):
'''Page title format for different URIs.'''
"""Page title format for different URIs."""
issueNum = '1000'
defaultTitle = 'Web Compatibility'
website_uris = [
Expand All @@ -49,5 +60,13 @@ def test_titles(self):
title=title)
self.assertTrue(expected in rv.data)

def test_user_title_pages(self):
"""Testing user activity page title."""
title = "<title>testuser's Activity | webcompat.com</title>"
with webcompat.app.app_context():
self.login('testuser', 'foobar')
rv = self.app.get('/activity/testuser')
self.assertTrue(title in rv.data)

if __name__ == '__main__':
unittest.main()

0 comments on commit dd8102a

Please sign in to comment.