| 172 |
ashish |
1 |
# -*- coding: utf-8 -*-
|
|
|
2 |
"""
|
|
|
3 |
Functional test suite for the root controller.
|
|
|
4 |
|
|
|
5 |
This is an example of how functional tests can be written for controllers.
|
|
|
6 |
|
|
|
7 |
As opposed to a unit-test, which test a small unit of functionality,
|
|
|
8 |
functional tests exercise the whole application and its WSGI stack.
|
|
|
9 |
|
|
|
10 |
Please read http://pythonpaste.org/webtest/ for more information.
|
|
|
11 |
|
|
|
12 |
"""
|
|
|
13 |
from nose.tools import assert_true
|
|
|
14 |
|
|
|
15 |
from wiki20.tests import TestController
|
|
|
16 |
|
|
|
17 |
|
|
|
18 |
class TestRootController(TestController):
|
|
|
19 |
def test_index(self):
|
|
|
20 |
response = self.app.get('/')
|
|
|
21 |
msg = 'TurboGears 2 is rapid web application development toolkit '\
|
|
|
22 |
'designed to make your life easier.'
|
|
|
23 |
# You can look for specific strings:
|
|
|
24 |
assert_true(msg in response)
|
|
|
25 |
|
|
|
26 |
# You can also access a BeautifulSoup'ed response in your tests
|
|
|
27 |
# (First run $ easy_install BeautifulSoup
|
|
|
28 |
# and then uncomment the next two lines)
|
|
|
29 |
|
|
|
30 |
#links = response.html.findAll('a')
|
|
|
31 |
#print links
|
|
|
32 |
#assert_true(links, "Mummy, there are no links here!")
|