##// END OF EJS Templates
Use only mustcontain for testing response body
marcink -
r3646:63e49418 beta
parent child Browse files
Show More
@@ -33,6 +33,7 b' from paste.script.appinstall import Setu'
33 33 from pylons import config, url
34 34 from routes.util import URLGenerator
35 35 from webtest import TestApp
36 from nose.plugins.skip import SkipTest
36 37
37 38 from rhodecode import is_windows
38 39 from rhodecode.model.meta import Session
@@ -51,6 +52,7 b' log = logging.getLogger(__name__)'
51 52
52 53 __all__ = [
53 54 'parameterized', 'environ', 'url', 'get_new_dir', 'TestController',
55 'SkipTest',
54 56 'TESTS_TMP_PATH', 'HG_REPO', 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO',
55 57 'HG_FORK', 'GIT_FORK', 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_ADMIN_PASS',
56 58 'TEST_USER_REGULAR_LOGIN', 'TEST_USER_REGULAR_PASS',
@@ -1,6 +1,5 b''
1 1 from rhodecode.tests import *
2 2 from rhodecode.model.db import RhodeCodeSetting
3 from nose.plugins.skip import SkipTest
4 3
5 4 skip_ldap_test = False
6 5 try:
@@ -17,7 +16,7 b' class TestLdapSettingsController(TestCon'
17 16 self.log_user()
18 17 response = self.app.get(url(controller='admin/ldap_settings',
19 18 action='index'))
20 self.assertTrue('LDAP administration' in response.body)
19 response.mustcontain('LDAP administration')
21 20
22 21 def test_ldap_save_settings(self):
23 22 self.log_user()
@@ -72,14 +71,12 b' class TestLdapSettingsController(TestCon'
72 71 'ldap_attr_lastname':'',
73 72 'ldap_attr_email':'' })
74 73
75 self.assertTrue("""<span class="error-message">The LDAP Login"""
76 """ attribute of the CN must be specified""" in
77 response.body)
74 response.mustcontain("""<span class="error-message">The LDAP Login"""
75 """ attribute of the CN must be specified""")
78 76
79 77
80
81 self.assertTrue("""<span class="error-message">Please """
82 """enter a number</span>""" in response.body)
78 response.mustcontain("""<span class="error-message">Please """
79 """enter a number</span>""")
83 80
84 81 def test_ldap_login(self):
85 82 pass
@@ -22,8 +22,7 b' class TestNotificationsController(TestCo'
22 22 u1 = u1.user_id
23 23
24 24 response = self.app.get(url('notifications'))
25 self.assertTrue('''<div class="table">No notifications here yet</div>'''
26 in response.body)
25 response.mustcontain('<div class="table">No notifications here yet</div>')
27 26
28 27 cur_user = self._get_logged_user()
29 28
@@ -32,7 +31,7 b' class TestNotificationsController(TestCo'
32 31 recipients=[cur_user])
33 32 self.Session().commit()
34 33 response = self.app.get(url('notifications'))
35 self.assertTrue(u'test_notification_1' in response.body)
34 response.mustcontain(u'test_notification_1')
36 35
37 36 # def test_index_as_xml(self):
38 37 # response = self.app.get(url('formatted_notifications', format='xml'))
@@ -90,8 +90,7 b' class TestAdminSettingsController(TestCo'
90 90 .get_app_settings()['rhodecode_ga_code'], new_ga_code)
91 91
92 92 response = response.follow()
93 self.assertFalse("""_gaq.push(['_setAccount', '%s']);""" % new_ga_code
94 in response.body)
93 response.mustcontain(no=["_gaq.push(['_setAccount', '%s']);" % new_ga_code])
95 94
96 95 def test_title_change(self):
97 96 self.log_user()
@@ -120,7 +119,7 b' class TestAdminSettingsController(TestCo'
120 119 self.log_user()
121 120 response = self.app.get(url('admin_settings_my_account'))
122 121
123 self.assertTrue('value="test_admin' in response.body)
122 response.mustcontain('value="test_admin')
124 123
125 124 @parameterized.expand([('firstname', 'new_username'),
126 125 ('lastname', 'new_username'),
@@ -217,7 +216,7 b' class TestAdminSettingsController(TestCo'
217 216 repo = Repository.get_by_repo_name(HG_REPO)
218 217 response = self.app.get(url('edit_repo', repo_name=HG_REPO))
219 218 opt = """<option value="%s">vcs_test_git</option>""" % repo.repo_id
220 assert opt not in response.body
219 response.mustcontain(no=[opt])
221 220
222 221 def test_set_fork_of_repo(self):
223 222 self.log_user()
@@ -1,13 +1,24 b''
1 1 from rhodecode.tests import *
2 2
3
3 4 class TestFollowersController(TestController):
4 5
5 def test_index(self):
6 def test_index_hg(self):
6 7 self.log_user()
7 8 repo_name = HG_REPO
8 9 response = self.app.get(url(controller='followers',
9 10 action='followers',
10 11 repo_name=repo_name))
11 12
12 self.assertTrue("""test_admin""" in response.body)
13 self.assertTrue("""Started following""" in response.body)
13 response.mustcontain("""test_admin""")
14 response.mustcontain("""Started following""")
15
16 def test_index_git(self):
17 self.log_user()
18 repo_name = GIT_REPO
19 response = self.app.get(url(controller='followers',
20 action='followers',
21 repo_name=repo_name))
22
23 response.mustcontain("""test_admin""")
24 response.mustcontain("""Started following""")
@@ -27,7 +27,7 b' class TestForksController(TestController'
27 27 response = self.app.get(url(controller='forks', action='forks',
28 28 repo_name=repo_name))
29 29
30 self.assertTrue("""There are no forks yet""" in response.body)
30 response.mustcontain("""There are no forks yet""")
31 31
32 32 def test_no_permissions_to_fork(self):
33 33 usr = self.log_user(TEST_USER_REGULAR_LOGIN,
@@ -135,7 +135,7 b' class TestForksController(TestController'
135 135 response = self.app.get(url(controller='summary', action='index',
136 136 repo_name=fork_name))
137 137
138 self.assertTrue('Fork of %s' % repo_name in response.body)
138 response.mustcontain('Fork of %s' % repo_name)
139 139
140 140 def test_zz_fork_permission_page(self):
141 141 usr = self.log_user(self.username, self.password)['user_id']
@@ -1,6 +1,5 b''
1 1 import os
2 2 from rhodecode.tests import *
3 from nose.plugins.skip import SkipTest
4 3
5 4
6 5 class TestSearchController(TestController):
@@ -9,8 +8,7 b' class TestSearchController(TestControlle'
9 8 self.log_user()
10 9 response = self.app.get(url(controller='search', action='index'))
11 10
12 self.assertTrue('class="small" id="q" name="q" type="text"' in
13 response.body)
11 response.mustcontain('class="small" id="q" name="q" type="text"')
14 12 # Test response...
15 13
16 14 def test_empty_search(self):
@@ -20,8 +18,8 b' class TestSearchController(TestControlle'
20 18 self.log_user()
21 19 response = self.app.get(url(controller='search', action='index'),
22 20 {'q': HG_REPO})
23 self.assertTrue('There is no index to search in. '
24 'Please run whoosh indexer' in response.body)
21 response.mustcontain('There is no index to search in. '
22 'Please run whoosh indexer')
25 23
26 24 def test_normal_search(self):
27 25 self.log_user()
General Comments 0
You need to be logged in to leave comments. Login now