Show More
@@ -31,7 +31,16 b' class TestController(TestCase):' | |||
|
31 | 31 | wsgiapp = pylons.test.pylonsapp |
|
32 | 32 | config = wsgiapp.config |
|
33 | 33 | self.app = TestApp(wsgiapp) |
|
34 | self.session = session | |
|
34 | 35 | url._push_object(URLGenerator(config['routes.map'], environ)) |
|
35 | 36 | self.sa = meta.Session |
|
36 | 37 | TestCase.__init__(self, *args, **kwargs) |
|
37 | 38 | |
|
39 | ||
|
40 | def log_user(self): | |
|
41 | response = self.app.post(url(controller='login', action='index'), | |
|
42 | {'username':'test_admin', | |
|
43 | 'password':'test'}) | |
|
44 | assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status | |
|
45 | assert response.session['hg_app_user'].username == 'test_admin', 'wrong logged in user' | |
|
46 | return response.follow() No newline at end of file |
@@ -3,6 +3,9 b' from pylons_app.tests import *' | |||
|
3 | 3 | class TestAdminController(TestController): |
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | ||
|
6 | self.log_user() | |
|
7 | 7 | response = self.app.get(url(controller='hg', action='index')) |
|
8 | # Test response... No newline at end of file | |
|
8 | #if global permission is set | |
|
9 | assert 'ADD NEW REPOSITORY' in response.body, 'Wrong main page' | |
|
10 | assert 'href="/vcs_test/summary"' in response.body, ' mising repository in list' | |
|
11 | # Test response... |
@@ -3,5 +3,13 b' from pylons_app.tests import *' | |||
|
3 | 3 | class TestSearchController(TestController): |
|
4 | 4 | |
|
5 | 5 | def test_index(self): |
|
6 | self.log_user() | |
|
6 | 7 | response = self.app.get(url(controller='search', action='index')) |
|
8 | print response.body | |
|
9 | assert 'class="small" id="q" name="q" type="text"' in response.body,'Search box content error' | |
|
7 | 10 | # Test response... |
|
11 | ||
|
12 | def test_empty_search(self): | |
|
13 | self.log_user() | |
|
14 | response = self.app.get(url(controller='search', action='index'),{'q':'vcs_test'}) | |
|
15 | assert 'There is no index to search in. Please run whoosh indexer' in response.body,'No error message about empty index' No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now