##// END OF EJS Templates
fixed broken test after latest changes
marcink -
r782:51127b2e beta
parent child Browse files
Show More
@@ -1,72 +1,72 b''
1 1 """Pylons application test package
2 2
3 3 This package assumes the Pylons environment is already loaded, such as
4 4 when this script is imported from the `nosetests --with-pylons=test.ini`
5 5 command.
6 6
7 7 This module initializes the application via ``websetup`` (`paster
8 8 setup-app`) and provides the base testing objects.
9 9 """
10 10 from unittest import TestCase
11 11
12 12 from paste.deploy import loadapp
13 13 from paste.script.appinstall import SetupCommand
14 14 from pylons import config, url
15 15 from routes.util import URLGenerator
16 16 from webtest import TestApp
17 17 import os
18 18 from rhodecode.model import meta
19 19 import logging
20 20
21 21
22 22 log = logging.getLogger(__name__)
23 23
24 24 import pylons.test
25 25
26 26 __all__ = ['environ', 'url', 'TestController', 'TESTS_TMP_PATH', 'HG_REPO',
27 27 'GIT_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK', ]
28 28
29 29 # Invoke websetup with the current config file
30 30 #SetupCommand('setup-app').run([config_file])
31 31
32 32 ##RUNNING DESIRED TESTS
33 #nosetests rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account
33 #nosetests -x rhodecode.tests.functional.test_admin_settings:TestSettingsController.test_my_account
34 34
35 35 environ = {}
36 36
37 37 #SOME GLOBALS FOR TESTS
38 38 TESTS_TMP_PATH = '/tmp'
39 39
40 40 HG_REPO = 'vcs_test_hg'
41 41 GIT_REPO = 'vcs_test_git'
42 42
43 43 NEW_HG_REPO = 'vcs_test_hg_new'
44 44 NEW_GIT_REPO = 'vcs_test_git_new'
45 45
46 46 HG_FORK = 'vcs_test_hg_fork'
47 47 GIT_FORK = 'vcs_test_git_fork'
48 48
49 49 class TestController(TestCase):
50 50
51 51 def __init__(self, *args, **kwargs):
52 52 wsgiapp = pylons.test.pylonsapp
53 53 config = wsgiapp.config
54 54
55 55 self.app = TestApp(wsgiapp)
56 56 url._push_object(URLGenerator(config['routes.map'], environ))
57 57 self.sa = meta.Session
58 58 self.index_location = config['app_conf']['index_dir']
59 59 TestCase.__init__(self, *args, **kwargs)
60 60
61 61 def log_user(self, username='test_admin', password='test12'):
62 62 response = self.app.post(url(controller='login', action='index'),
63 63 {'username':username,
64 64 'password':password})
65 65 print response
66 66
67 67 if 'invalid user name' in response.body:
68 68 assert False, 'could not login using %s %s' % (username, password)
69 69
70 70 assert response.status == '302 Found', 'Wrong response code from login got %s' % response.status
71 71 assert response.session['rhodecode_user'].username == username, 'wrong logged in user got %s expected %s' % (response.session['rhodecode_user'].username, username)
72 72 return response.follow()
@@ -1,136 +1,136 b''
1 1 from rhodecode.lib.auth import get_crypt_password, check_password
2 2 from rhodecode.model.db import User
3 3 from rhodecode.tests import *
4 4
5 5 class TestAdminSettingsController(TestController):
6 6
7 7 def test_index(self):
8 8 response = self.app.get(url('admin_settings'))
9 9 # Test response...
10 10
11 11 def test_index_as_xml(self):
12 12 response = self.app.get(url('formatted_admin_settings', format='xml'))
13 13
14 14 def test_create(self):
15 15 response = self.app.post(url('admin_settings'))
16 16
17 17 def test_new(self):
18 18 response = self.app.get(url('admin_new_setting'))
19 19
20 20 def test_new_as_xml(self):
21 21 response = self.app.get(url('formatted_admin_new_setting', format='xml'))
22 22
23 23 def test_update(self):
24 24 response = self.app.put(url('admin_setting', setting_id=1))
25 25
26 26 def test_update_browser_fakeout(self):
27 27 response = self.app.post(url('admin_setting', setting_id=1), params=dict(_method='put'))
28 28
29 29 def test_delete(self):
30 30 response = self.app.delete(url('admin_setting', setting_id=1))
31 31
32 32 def test_delete_browser_fakeout(self):
33 33 response = self.app.post(url('admin_setting', setting_id=1), params=dict(_method='delete'))
34 34
35 35 def test_show(self):
36 36 response = self.app.get(url('admin_setting', setting_id=1))
37 37
38 38 def test_show_as_xml(self):
39 39 response = self.app.get(url('formatted_admin_setting', setting_id=1, format='xml'))
40 40
41 41 def test_edit(self):
42 42 response = self.app.get(url('admin_edit_setting', setting_id=1))
43 43
44 44 def test_edit_as_xml(self):
45 45 response = self.app.get(url('formatted_admin_edit_setting', setting_id=1, format='xml'))
46 46
47 47 def test_my_account(self):
48 48 self.log_user()
49 49 response = self.app.get(url('admin_settings_my_account'))
50 50 print response
51 51 assert 'value="test_admin' in response.body
52 52
53 53
54 54
55 55 def test_my_account_update(self):
56 56 self.log_user()
57 57
58 58 new_email = 'new@mail.pl'
59 59 new_name = 'NewName'
60 60 new_lastname = 'NewLastname'
61 61 new_password = 'test123'
62 62
63 63
64 64 response = self.app.post(url('admin_settings_my_account_update'), params=dict(
65 65 _method='put',
66 66 username='test_admin',
67 67 new_password=new_password,
68 68 password='',
69 69 name=new_name,
70 70 lastname=new_lastname,
71 71 email=new_email,))
72 72 response.follow()
73 73
74 assert 'Your account was updated succesfully' in response.session['flash'][0][1], 'no flash message about success of change'
74 assert 'Your account was updated successfully' in response.session['flash'][0][1], 'no flash message about success of change'
75 75 user = self.sa.query(User).filter(User.username == 'test_admin').one()
76 76 assert user.email == new_email , 'incorrect user email after update got %s vs %s' % (user.email, new_email)
77 77 assert user.name == new_name, 'updated field mismatch %s vs %s' % (user.name, new_name)
78 78 assert user.lastname == new_lastname, 'updated field mismatch %s vs %s' % (user.lastname, new_lastname)
79 79 assert check_password(new_password, user.password) is True, 'password field mismatch %s vs %s' % (user.password, new_password)
80 80
81 81 #bring back the admin settings
82 82 old_email = 'test_admin@mail.com'
83 83 old_name = 'RhodeCode'
84 84 old_lastname = 'Admin'
85 85 old_password = 'test12'
86 86
87 87 response = self.app.post(url('admin_settings_my_account_update'), params=dict(
88 88 _method='put',
89 89 username='test_admin',
90 90 new_password=old_password,
91 91 password='',
92 92 name=old_name,
93 93 lastname=old_lastname,
94 94 email=old_email,))
95 95
96 96 response.follow()
97 assert 'Your account was updated succesfully' in response.session['flash'][0][1], 'no flash message about success of change'
97 assert 'Your account was updated successfully' in response.session['flash'][0][1], 'no flash message about success of change'
98 98 user = self.sa.query(User).filter(User.username == 'test_admin').one()
99 99 assert user.email == old_email , 'incorrect user email after update got %s vs %s' % (user.email, old_email)
100 100
101 101 assert user.email == old_email , 'incorrect user email after update got %s vs %s' % (user.email, old_email)
102 102 assert user.name == old_name, 'updated field mismatch %s vs %s' % (user.name, old_name)
103 103 assert user.lastname == old_lastname, 'updated field mismatch %s vs %s' % (user.lastname, old_lastname)
104 104 assert check_password(old_password, user.password) is True , 'password updated field mismatch %s vs %s' % (user.password, old_password)
105 105
106 106
107 107 def test_my_account_update_err_email_exists(self):
108 108 self.log_user()
109 109
110 110 new_email = 'test_regular@mail.com'#already exisitn email
111 111 response = self.app.post(url('admin_settings_my_account_update'), params=dict(
112 112 _method='put',
113 113 username='test_admin',
114 114 new_password='test12',
115 115 name='NewName',
116 116 lastname='NewLastname',
117 117 email=new_email,))
118 118 print response
119 119
120 120 assert 'This e-mail address is already taken' in response.body, 'Missing error message about existing email'
121 121
122 122
123 123 def test_my_account_update_err(self):
124 124 self.log_user('test_regular2', 'test12')
125 125
126 126 new_email = 'newmail.pl'
127 127 response = self.app.post(url('admin_settings_my_account_update'), params=dict(
128 128 _method='put',
129 129 username='test_admin',
130 130 new_password='test12',
131 131 name='NewName',
132 132 lastname='NewLastname',
133 133 email=new_email,))
134 134 print response
135 135 assert 'An email address must contain a single @' in response.body, 'Missing error message about wrong email'
136 136 assert 'This username already exists' in response.body, 'Missing error message about existing user'
@@ -1,165 +1,190 b''
1 1 from rhodecode.tests import *
2 2
3 3 class TestFilesController(TestController):
4 4
5 5 def test_index(self):
6 6 self.log_user()
7 7 response = self.app.get(url(controller='files', action='index',
8 8 repo_name=HG_REPO,
9 9 revision='tip',
10 10 f_path='/'))
11 11 # Test response...
12 12 assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/docs">docs</a>' in response.body, 'missing dir'
13 13 assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/tests">tests</a>' in response.body, 'missing dir'
14 14 assert '<a class="browser-dir" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/vcs">vcs</a>' in response.body, 'missing dir'
15 15 assert '<a class="browser-file" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/.hgignore">.hgignore</a>' in response.body, 'missing file'
16 16 assert '<a class="browser-file" href="/vcs_test_hg/files/27cd5cce30c96924232dffcd24178a07ffeb5dfc/MANIFEST.in">MANIFEST.in</a>' in response.body, 'missing file'
17 17
18 18
19 19 def test_index_revision(self):
20 20 self.log_user()
21 21
22 22 response = self.app.get(url(controller='files', action='index',
23 23 repo_name=HG_REPO,
24 24 revision='7ba66bec8d6dbba14a2155be32408c435c5f4492',
25 25 f_path='/'))
26 26
27 27
28 28
29 29 #Test response...
30 30
31 31 assert '<a class="browser-dir" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/docs">docs</a>' in response.body, 'missing dir'
32 32 assert '<a class="browser-dir" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/tests">tests</a>' in response.body, 'missing dir'
33 33 assert '<a class="browser-file" href="/vcs_test_hg/files/7ba66bec8d6dbba14a2155be32408c435c5f4492/README.rst">README.rst</a>' in response.body, 'missing file'
34 34 assert '1.1 KiB' in response.body, 'missing size of setup.py'
35 35 assert 'text/x-python' in response.body, 'missing mimetype of setup.py'
36 36
37 37
38 38
39 39 def test_index_different_branch(self):
40 40 self.log_user()
41 41
42 42 response = self.app.get(url(controller='files', action='index',
43 43 repo_name=HG_REPO,
44 44 revision='97e8b885c04894463c51898e14387d80c30ed1ee',
45 45 f_path='/'))
46 46
47 47
48 48
49 49 assert """<span style="text-transform: uppercase;"><a href="#">branch: git</a></span>""" in response.body, 'missing or wrong branch info'
50 50
51 51
52 52
53 53 def test_index_paging(self):
54 54 self.log_user()
55 55
56 56 for r in [(73, 'a066b25d5df7016b45a41b7e2a78c33b57adc235'),
57 57 (92, 'cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e'),
58 58 (109, '75feb4c33e81186c87eac740cee2447330288412'),
59 59 (1, '3d8f361e72ab303da48d799ff1ac40d5ac37c67e'),
60 60 (0, 'b986218ba1c9b0d6a259fac9b050b1724ed8e545')]:
61 61
62 62 response = self.app.get(url(controller='files', action='index',
63 63 repo_name=HG_REPO,
64 64 revision=r[1],
65 65 f_path='/'))
66 66
67 67 assert """@ r%s:%s""" % (r[0], r[1][:12]) in response.body, 'missing info about current revision'
68 68
69 69 def test_file_source(self):
70 70 self.log_user()
71 71 response = self.app.get(url(controller='files', action='index',
72 72 repo_name=HG_REPO,
73 73 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
74 74 f_path='vcs/nodes.py'))
75 75
76 76 #test or history
77 assert """<select id="diff1" name="diff1">
77 assert """<optgroup label="Changesets">
78 78 <option selected="selected" value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776</option>
79 79 <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35</option>
80 80 <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c</option>
81 81 <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329</option>
82 82 <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf</option>
83 83 <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81</option>
84 84 <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc</option>
85 85 <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21</option>
86 86 <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2</option>
87 87 <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85</option>
88 88 <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2</option>
89 89 <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93</option>
90 90 <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b</option>
91 91 <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455</option>
92 92 <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32</option>
93 93 <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0</option>
94 94 <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081</option>
95 95 <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad</option>
96 96 <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7</option>
97 97 <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059</option>
98 98 <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb</option>
99 99 <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1</option>
100 100 <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71</option>
101 101 <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771</option>
102 102 <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526</option>
103 103 <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4</option>
104 104 <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b</option>
105 105 <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c</option>
106 106 <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1</option>
107 107 <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5</option>
108 108 <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283</option>
109 109 <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6</option>
110 110 <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3</option>
111 </select>""" in response.body
111 </optgroup>
112 <optgroup label="Branches">
113 <option value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">default</option>
114 <option value="97e8b885c04894463c51898e14387d80c30ed1ee">git</option>
115 <option value="2e6a2bf9356ca56df08807f4ad86d480da72a8f4">web</option>
116 </optgroup>
117 <optgroup label="Tags">
118 <option value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">tip</option>
119 <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">0.1.4</option>
120 <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">0.1.3</option>
121 <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">0.1.2</option>
122 <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">0.1.1</option>
123 </optgroup>""" in response.body
112 124
113 125
114 126 assert """<div class="commit">"Partially implemented #16. filecontent/commit message/author/node name are safe_unicode now.
115 127 In addition some other __str__ are unicode as well
116 128 Added test for unicode
117 129 Improved test to clone into uniq repository.
118 130 removed extra unicode conversion in diff."</div>""" in response.body
119 131
120 132 assert """<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""" in response.body, 'missing or wrong branch info'
121 133
122 134 def test_file_annotation(self):
123 135 self.log_user()
124 136 response = self.app.get(url(controller='files', action='annotate',
125 137 repo_name=HG_REPO,
126 138 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
127 139 f_path='vcs/nodes.py'))
128 140
129
130 assert """<option selected="selected" value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776</option>
141 print response.body
142 assert """<optgroup label="Changesets">
143 <option selected="selected" value="8911406ad776fdd3d0b9932a2e89677e57405a48">r167:8911406ad776</option>
131 144 <option value="aa957ed78c35a1541f508d2ec90e501b0a9e3167">r165:aa957ed78c35</option>
132 145 <option value="48e11b73e94c0db33e736eaeea692f990cb0b5f1">r140:48e11b73e94c</option>
133 146 <option value="adf3cbf483298563b968a6c673cd5bde5f7d5eea">r126:adf3cbf48329</option>
134 147 <option value="6249fd0fb2cfb1411e764129f598e2cf0de79a6f">r113:6249fd0fb2cf</option>
135 148 <option value="75feb4c33e81186c87eac740cee2447330288412">r109:75feb4c33e81</option>
136 149 <option value="9a4dc232ecdc763ef2e98ae2238cfcbba4f6ad8d">r108:9a4dc232ecdc</option>
137 150 <option value="595cce4efa21fda2f2e4eeb4fe5f2a6befe6fa2d">r107:595cce4efa21</option>
138 151 <option value="4a8bd421fbc2dfbfb70d85a3fe064075ab2c49da">r104:4a8bd421fbc2</option>
139 152 <option value="57be63fc8f85e65a0106a53187f7316f8c487ffa">r102:57be63fc8f85</option>
140 153 <option value="5530bd87f7e2e124a64d07cb2654c997682128be">r101:5530bd87f7e2</option>
141 154 <option value="e516008b1c93f142263dc4b7961787cbad654ce1">r99:e516008b1c93</option>
142 155 <option value="41f43fc74b8b285984554532eb105ac3be5c434f">r93:41f43fc74b8b</option>
143 156 <option value="cc66b61b8455b264a7a8a2d8ddc80fcfc58c221e">r92:cc66b61b8455</option>
144 157 <option value="73ab5b616b3271b0518682fb4988ce421de8099f">r91:73ab5b616b32</option>
145 158 <option value="e0da75f308c0f18f98e9ce6257626009fdda2b39">r82:e0da75f308c0</option>
146 159 <option value="fb2e41e0f0810be4d7103bc2a4c7be16ee3ec611">r81:fb2e41e0f081</option>
147 160 <option value="602ae2f5e7ade70b3b66a58cdd9e3e613dc8a028">r76:602ae2f5e7ad</option>
148 161 <option value="a066b25d5df7016b45a41b7e2a78c33b57adc235">r73:a066b25d5df7</option>
149 162 <option value="637a933c905958ce5151f154147c25c1c7b68832">r61:637a933c9059</option>
150 163 <option value="0c21004effeb8ce2d2d5b4a8baf6afa8394b6fbc">r60:0c21004effeb</option>
151 164 <option value="a1f39c56d3f1d52d5fb5920370a2a2716cd9a444">r59:a1f39c56d3f1</option>
152 165 <option value="97d32df05c715a3bbf936bf3cc4e32fb77fe1a7f">r58:97d32df05c71</option>
153 166 <option value="08eaf14517718dccea4b67755a93368341aca919">r57:08eaf1451771</option>
154 167 <option value="22f71ad265265a53238359c883aa976e725aa07d">r56:22f71ad26526</option>
155 168 <option value="97501f02b7b4330924b647755663a2d90a5e638d">r49:97501f02b7b4</option>
156 169 <option value="86ede6754f2b27309452bb11f997386ae01d0e5a">r47:86ede6754f2b</option>
157 170 <option value="014c40c0203c423dc19ecf94644f7cac9d4cdce0">r45:014c40c0203c</option>
158 171 <option value="ee87846a61c12153b51543bf860e1026c6d3dcba">r30:ee87846a61c1</option>
159 172 <option value="9bb326a04ae5d98d437dece54be04f830cf1edd9">r26:9bb326a04ae5</option>
160 173 <option value="536c1a19428381cfea92ac44985304f6a8049569">r24:536c1a194283</option>
161 174 <option value="dc5d2c0661b61928834a785d3e64a3f80d3aad9c">r8:dc5d2c0661b6</option>
162 175 <option value="3803844fdbd3b711175fc3da9bdacfcd6d29a6fb">r7:3803844fdbd3</option>
163 </select>""" in response.body, 'missing history in annotation'
176 </optgroup>
177 <optgroup label="Branches">
178 <option value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">default</option>
179 <option value="97e8b885c04894463c51898e14387d80c30ed1ee">git</option>
180 <option value="2e6a2bf9356ca56df08807f4ad86d480da72a8f4">web</option>
181 </optgroup>
182 <optgroup label="Tags">
183 <option value="27cd5cce30c96924232dffcd24178a07ffeb5dfc">tip</option>
184 <option value="fd4bdb5e9b2a29b4393a4ac6caef48c17ee1a200">0.1.4</option>
185 <option value="17544fbfcd33ffb439e2b728b5d526b1ef30bfcf">0.1.3</option>
186 <option value="a7e60bff65d57ac3a1a1ce3b12a70f8a9e8a7720">0.1.2</option>
187 <option value="eb3a60fc964309c1a318b8dfe26aa2d1586c85ae">0.1.1</option>
188 </optgroup>""" in response.body, 'missing or wrong history in annotation'
164 189
165 190 assert """<span style="text-transform: uppercase;"><a href="#">branch: default</a></span>""" in response.body, 'missing or wrong branch info'
@@ -1,17 +1,19 b''
1 1 from rhodecode.tests import *
2 2
3 3 class TestSummaryController(TestController):
4 4
5 5 def test_index(self):
6 6 self.log_user()
7 7 response = self.app.get(url(controller='summary', action='index', repo_name=HG_REPO))
8 8
9 9 #repo type
10 10 assert """<img style="margin-bottom:2px" class="icon" title="Mercurial repository" alt="Mercurial repository" src="/images/icons/hgicon.png"/>""" in response.body
11 11 assert """<img style="margin-bottom:2px" class="icon" title="public repository" alt="public repository" src="/images/icons/lock_open.png"/>""" in response.body
12 12
13 13 #codes stats
14 assert """var data = {"text/x-python": 42, "text/plain": 12};""" in response.body, 'wrong info about % of codes stats'
14 assert """var data = {"Python": 42, "Rst": 11, "Bash": 2, "Makefile": 1, "Batch": 1, "Ini": 1, "Css": 1};""" in response.body, 'wrong info about % of codes stats'
15 15
16 16 # clone url...
17 17 assert """<input type="text" id="clone_url" readonly="readonly" value="hg clone http://test_admin@localhost:80/%s" size="70"/>""" % HG_REPO in response.body
18
19
General Comments 0
You need to be logged in to leave comments. Login now