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