-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathtests.py
More file actions
53 lines (41 loc) · 1.99 KB
/
tests.py
File metadata and controls
53 lines (41 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
Unit tests for the Deis web app.
Run the tests with "./manage.py test web"
"""
from __future__ import unicode_literals
from django.test import TestCase
class WebViewsTest(TestCase):
fixtures = ['test_web.json']
def setUp(self):
self.client.login(username='autotest-1', password='password')
def test_account(self):
response = self.client.get('/account/')
self.assertContains(response, '<title>Deis | Account</title>', html=True)
self.assertContains(response, 'autotest-1')
self.assertContains(response, '<img src="//www.gravatar.com/avatar')
self.assertContains(
response, '<form method="post" action="/accounts/logout/">')
def test_dashboard(self):
response = self.client.get('/')
self.assertContains(response, '<title>Deis | Dashboard</title>', html=True)
self.assertContains(
response,
r'You have <a href="/formations/">one formation</a> and <a href="/apps/">one app</a>.')
def test_formations(self):
response = self.client.get('/formations/')
self.assertContains(response, '<title>Deis | Formations</title>', html=True)
self.assertContains(response, '<h1>One Formation</h1>')
self.assertContains(response, '<h3>autotest-1</h3>')
self.assertContains(response, '<dt>Owned by</dt>')
self.assertContains(response, '<dd>autotest-1</dd>')
def test_apps(self):
response = self.client.get('/apps/')
self.assertContains(response, '<title>Deis | Apps</title>', html=True)
self.assertContains(response, '<h1>One App</h1>')
self.assertContains(response, '<h3>autotest-1-app</h3>')
def test_support(self):
response = self.client.get('/support/')
self.assertContains(response, '<title>Deis | Support</title>', html=True)
self.assertContains(response, '<div class="forkImage">')
self.assertContains(response, '<h2>IRC</h2>')
self.assertContains(response, '<h2>GitHub</h2>')