Show More
@@ -1,175 +1,175 b'' | |||
|
1 | 1 | from rhodecode.tests import * |
|
2 | 2 | |
|
3 | 3 | from rhodecode.model.db import Repository |
|
4 | 4 | from rhodecode.model.repo import RepoModel |
|
5 | 5 | from rhodecode.model.user import UserModel |
|
6 | 6 | from rhodecode.model.meta import Session |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 | class TestForksController(TestController): |
|
10 | 10 | |
|
11 | 11 | def setUp(self): |
|
12 | 12 | self.username = u'forkuser' |
|
13 | 13 | self.password = u'qweqwe' |
|
14 | 14 | self.u1 = UserModel().create_or_update( |
|
15 | 15 | username=self.username, password=self.password, |
|
16 | 16 | email=u'fork_king@rhodecode.org', firstname=u'u1', lastname=u'u1' |
|
17 | 17 | ) |
|
18 | 18 | Session().commit() |
|
19 | 19 | |
|
20 | 20 | def tearDown(self): |
|
21 | 21 | Session().delete(self.u1) |
|
22 | 22 | Session().commit() |
|
23 | 23 | |
|
24 | 24 | def test_index(self): |
|
25 | 25 | self.log_user() |
|
26 | 26 | repo_name = HG_REPO |
|
27 | 27 | response = self.app.get(url(controller='forks', action='forks', |
|
28 | 28 | repo_name=repo_name)) |
|
29 | 29 | |
|
30 | 30 | self.assertTrue("""There are no forks yet""" in response.body) |
|
31 | 31 | |
|
32 | 32 | def test_no_permissions_to_fork(self): |
|
33 | 33 | usr = self.log_user(TEST_USER_REGULAR_LOGIN, |
|
34 | 34 | TEST_USER_REGULAR_PASS)['user_id'] |
|
35 | 35 | user_model = UserModel() |
|
36 | 36 | user_model.revoke_perm(usr, 'hg.fork.repository') |
|
37 | 37 | user_model.grant_perm(usr, 'hg.fork.none') |
|
38 | 38 | u = UserModel().get(usr) |
|
39 | 39 | u.inherit_default_permissions = False |
|
40 | 40 | Session().commit() |
|
41 | 41 | # try create a fork |
|
42 | 42 | repo_name = HG_REPO |
|
43 | 43 | self.app.post(url(controller='forks', action='fork_create', |
|
44 | 44 | repo_name=repo_name), {}, status=403) |
|
45 | 45 | |
|
46 | 46 | def test_index_with_fork_hg(self): |
|
47 | 47 | self.log_user() |
|
48 | 48 | |
|
49 | 49 | # create a fork |
|
50 | 50 | fork_name = HG_FORK |
|
51 | 51 | description = 'fork of vcs test' |
|
52 | 52 | repo_name = HG_REPO |
|
53 | 53 | org_repo = Repository.get_by_repo_name(repo_name) |
|
54 | 54 | response = self.app.post(url(controller='forks', |
|
55 | 55 | action='fork_create', |
|
56 | 56 | repo_name=repo_name), |
|
57 | 57 | {'repo_name': fork_name, |
|
58 | 58 | 'repo_group': '', |
|
59 | 59 | 'fork_parent_id': org_repo.repo_id, |
|
60 | 60 | 'repo_type': 'hg', |
|
61 | 61 | 'description': description, |
|
62 | 62 | 'private': 'False', |
|
63 | 63 | 'landing_rev': 'tip'}) |
|
64 | 64 | |
|
65 | 65 | response = self.app.get(url(controller='forks', action='forks', |
|
66 | 66 | repo_name=repo_name)) |
|
67 | 67 | |
|
68 | 68 | response.mustcontain( |
|
69 |
"""<a href="/%s |
|
|
69 | """<a href="/%s">%s</a>""" % (fork_name, fork_name) | |
|
70 | 70 | ) |
|
71 | 71 | |
|
72 | 72 | #remove this fork |
|
73 | 73 | response = self.app.delete(url('repo', repo_name=fork_name)) |
|
74 | 74 | |
|
75 | 75 | def test_index_with_fork_git(self): |
|
76 | 76 | self.log_user() |
|
77 | 77 | |
|
78 | 78 | # create a fork |
|
79 | 79 | fork_name = GIT_FORK |
|
80 | 80 | description = 'fork of vcs test' |
|
81 | 81 | repo_name = GIT_REPO |
|
82 | 82 | org_repo = Repository.get_by_repo_name(repo_name) |
|
83 | 83 | response = self.app.post(url(controller='forks', |
|
84 | 84 | action='fork_create', |
|
85 | 85 | repo_name=repo_name), |
|
86 | 86 | {'repo_name': fork_name, |
|
87 | 87 | 'repo_group': '', |
|
88 | 88 | 'fork_parent_id': org_repo.repo_id, |
|
89 | 89 | 'repo_type': 'git', |
|
90 | 90 | 'description': description, |
|
91 | 91 | 'private': 'False', |
|
92 | 92 | 'landing_rev': 'tip'}) |
|
93 | 93 | |
|
94 | 94 | response = self.app.get(url(controller='forks', action='forks', |
|
95 | 95 | repo_name=repo_name)) |
|
96 | 96 | |
|
97 | 97 | response.mustcontain( |
|
98 |
"""<a href="/%s |
|
|
98 | """<a href="/%s">%s</a>""" % (fork_name, fork_name) | |
|
99 | 99 | ) |
|
100 | 100 | |
|
101 | 101 | #remove this fork |
|
102 | 102 | response = self.app.delete(url('repo', repo_name=fork_name)) |
|
103 | 103 | |
|
104 | 104 | def test_z_fork_create(self): |
|
105 | 105 | self.log_user() |
|
106 | 106 | fork_name = HG_FORK |
|
107 | 107 | description = 'fork of vcs test' |
|
108 | 108 | repo_name = HG_REPO |
|
109 | 109 | org_repo = Repository.get_by_repo_name(repo_name) |
|
110 | 110 | response = self.app.post(url(controller='forks', action='fork_create', |
|
111 | 111 | repo_name=repo_name), |
|
112 | 112 | {'repo_name':fork_name, |
|
113 | 113 | 'repo_group':'', |
|
114 | 114 | 'fork_parent_id':org_repo.repo_id, |
|
115 | 115 | 'repo_type':'hg', |
|
116 | 116 | 'description':description, |
|
117 | 117 | 'private':'False', |
|
118 | 118 | 'landing_rev': 'tip'}) |
|
119 | 119 | |
|
120 | 120 | #test if we have a message that fork is ok |
|
121 | 121 | self.checkSessionFlash(response, |
|
122 | 122 | 'forked %s repository as %s' % (repo_name, fork_name)) |
|
123 | 123 | |
|
124 | 124 | #test if the fork was created in the database |
|
125 | 125 | fork_repo = Session().query(Repository)\ |
|
126 | 126 | .filter(Repository.repo_name == fork_name).one() |
|
127 | 127 | |
|
128 | 128 | self.assertEqual(fork_repo.repo_name, fork_name) |
|
129 | 129 | self.assertEqual(fork_repo.fork.repo_name, repo_name) |
|
130 | 130 | |
|
131 | 131 | #test if fork is visible in the list ? |
|
132 | 132 | response = response.follow() |
|
133 | 133 | |
|
134 | 134 | response = self.app.get(url(controller='summary', action='index', |
|
135 | 135 | repo_name=fork_name)) |
|
136 | 136 | |
|
137 | 137 | self.assertTrue('Fork of %s' % repo_name in response.body) |
|
138 | 138 | |
|
139 | 139 | def test_zz_fork_permission_page(self): |
|
140 | 140 | usr = self.log_user(self.username, self.password)['user_id'] |
|
141 | 141 | repo_name = HG_REPO |
|
142 | 142 | |
|
143 | 143 | forks = Session().query(Repository)\ |
|
144 | 144 | .filter(Repository.fork_id != None)\ |
|
145 | 145 | .all() |
|
146 | 146 | self.assertEqual(1, len(forks)) |
|
147 | 147 | |
|
148 | 148 | # set read permissions for this |
|
149 | 149 | RepoModel().grant_user_permission(repo=forks[0], |
|
150 | 150 | user=usr, |
|
151 | 151 | perm='repository.read') |
|
152 | 152 | Session().commit() |
|
153 | 153 | |
|
154 | 154 | response = self.app.get(url(controller='forks', action='forks', |
|
155 | 155 | repo_name=repo_name)) |
|
156 | 156 | |
|
157 | 157 | response.mustcontain('<div style="padding:5px 3px 3px 42px;">fork of vcs test</div>') |
|
158 | 158 | |
|
159 | 159 | def test_zzz_fork_permission_page(self): |
|
160 | 160 | usr = self.log_user(self.username, self.password)['user_id'] |
|
161 | 161 | repo_name = HG_REPO |
|
162 | 162 | |
|
163 | 163 | forks = Session().query(Repository)\ |
|
164 | 164 | .filter(Repository.fork_id != None)\ |
|
165 | 165 | .all() |
|
166 | 166 | self.assertEqual(1, len(forks)) |
|
167 | 167 | |
|
168 | 168 | # set none |
|
169 | 169 | RepoModel().grant_user_permission(repo=forks[0], |
|
170 | 170 | user=usr, perm='repository.none') |
|
171 | 171 | Session().commit() |
|
172 | 172 | # fork shouldn't be there |
|
173 | 173 | response = self.app.get(url(controller='forks', action='forks', |
|
174 | 174 | repo_name=repo_name)) |
|
175 | 175 | response.mustcontain('There are no forks yet') |
@@ -1,108 +1,108 b'' | |||
|
1 | 1 | import time |
|
2 | 2 | from rhodecode.tests import * |
|
3 | 3 | from rhodecode.model.meta import Session |
|
4 | 4 | from rhodecode.model.db import User, RhodeCodeSetting, Repository |
|
5 | 5 | from rhodecode.lib.utils import set_rhodecode_config |
|
6 | 6 | from rhodecode.tests.models.common import _make_repo, _make_group |
|
7 | 7 | from rhodecode.model.repo import RepoModel |
|
8 | 8 | from rhodecode.model.repos_group import ReposGroupModel |
|
9 | 9 | |
|
10 | 10 | |
|
11 | 11 | class TestHomeController(TestController): |
|
12 | 12 | |
|
13 | 13 | def test_index(self): |
|
14 | 14 | self.log_user() |
|
15 | 15 | response = self.app.get(url(controller='home', action='index')) |
|
16 | 16 | #if global permission is set |
|
17 | 17 | response.mustcontain('Add repository') |
|
18 |
response.mustcontain('href="/%s |
|
|
18 | response.mustcontain('href="/%s"' % HG_REPO) | |
|
19 | 19 | |
|
20 | 20 | response.mustcontain("""<img class="icon" title="Mercurial repository" """ |
|
21 | 21 | """alt="Mercurial repository" src="/images/icons/hg""" |
|
22 | 22 | """icon.png"/>""") |
|
23 | 23 | response.mustcontain("""<img class="icon" title="public repository" """ |
|
24 | 24 | """alt="public repository" src="/images/icons/lock_""" |
|
25 | 25 | """open.png"/>""") |
|
26 | 26 | |
|
27 | 27 | response.mustcontain( |
|
28 | 28 | """<a title="Marcin Kuzminski &lt;marcin@python-works.com&gt;:\n |
|
29 | 29 | merge" class="tooltip" href="/vcs_test_hg/changeset/27cd5cce30c96924232""" |
|
30 | 30 | """dffcd24178a07ffeb5dfc">r173:27cd5cce30c9</a>""" |
|
31 | 31 | ) |
|
32 | 32 | |
|
33 | 33 | def test_repo_summary_with_anonymous_access_disabled(self): |
|
34 | 34 | anon = User.get_by_username('default') |
|
35 | 35 | anon.active = False |
|
36 | 36 | Session().add(anon) |
|
37 | 37 | Session().commit() |
|
38 | 38 | time.sleep(1.5) # must sleep for cache (1s to expire) |
|
39 | 39 | try: |
|
40 | 40 | response = self.app.get(url(controller='summary', |
|
41 | 41 | action='index', repo_name=HG_REPO), |
|
42 | 42 | status=302) |
|
43 | 43 | assert 'login' in response.location |
|
44 | 44 | |
|
45 | 45 | finally: |
|
46 | 46 | anon = User.get_by_username('default') |
|
47 | 47 | anon.active = True |
|
48 | 48 | Session().add(anon) |
|
49 | 49 | Session().commit() |
|
50 | 50 | |
|
51 | 51 | def test_index_with_anonymous_access_disabled(self): |
|
52 | 52 | anon = User.get_by_username('default') |
|
53 | 53 | anon.active = False |
|
54 | 54 | Session().add(anon) |
|
55 | 55 | Session().commit() |
|
56 | 56 | time.sleep(1.5) # must sleep for cache (1s to expire) |
|
57 | 57 | try: |
|
58 | 58 | response = self.app.get(url(controller='home', action='index'), |
|
59 | 59 | status=302) |
|
60 | 60 | assert 'login' in response.location |
|
61 | 61 | finally: |
|
62 | 62 | anon = User.get_by_username('default') |
|
63 | 63 | anon.active = True |
|
64 | 64 | Session().add(anon) |
|
65 | 65 | Session().commit() |
|
66 | 66 | |
|
67 | 67 | def _set_l_dash(self, set_to): |
|
68 | 68 | self.app.post(url('admin_setting', setting_id='visual'), |
|
69 | 69 | params=dict(_method='put', |
|
70 | 70 | rhodecode_lightweight_dashboard=set_to,)) |
|
71 | 71 | |
|
72 | 72 | def test_index_with_lightweight_dashboard(self): |
|
73 | 73 | self.log_user() |
|
74 | 74 | self._set_l_dash(True) |
|
75 | 75 | |
|
76 | 76 | try: |
|
77 | 77 | response = self.app.get(url(controller='home', action='index')) |
|
78 | 78 | response.mustcontain("""var data = {"totalRecords": %s""" % len(Repository.getAll())) |
|
79 | 79 | finally: |
|
80 | 80 | self._set_l_dash(False) |
|
81 | 81 | |
|
82 | 82 | def test_index_page_on_groups(self): |
|
83 | 83 | self.log_user() |
|
84 | 84 | _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1')) |
|
85 | 85 | Session().commit() |
|
86 | 86 | response = self.app.get(url('repos_group_home', group_name='gr1')) |
|
87 | 87 | |
|
88 | 88 | try: |
|
89 | 89 | response.mustcontain("""gr1/repo_in_group""") |
|
90 | 90 | finally: |
|
91 | 91 | RepoModel().delete('gr1/repo_in_group') |
|
92 | 92 | ReposGroupModel().delete(repos_group='gr1', force_delete=True) |
|
93 | 93 | Session().commit() |
|
94 | 94 | |
|
95 | 95 | def test_index_page_on_groups_with_lightweight_dashboard(self): |
|
96 | 96 | self.log_user() |
|
97 | 97 | self._set_l_dash(True) |
|
98 | 98 | _make_repo(name='gr1/repo_in_group', repos_group=_make_group('gr1')) |
|
99 | 99 | Session().commit() |
|
100 | 100 | response = self.app.get(url('repos_group_home', group_name='gr1')) |
|
101 | 101 | |
|
102 | 102 | try: |
|
103 | 103 | response.mustcontain("""gr1/repo_in_group""") |
|
104 | 104 | finally: |
|
105 | 105 | self._set_l_dash(False) |
|
106 | 106 | RepoModel().delete('gr1/repo_in_group') |
|
107 | 107 | ReposGroupModel().delete(repos_group='gr1', force_delete=True) |
|
108 | 108 | Session().commit() |
@@ -1,114 +1,114 b'' | |||
|
1 | 1 | import os |
|
2 | 2 | from rhodecode.tests import * |
|
3 | 3 | from nose.plugins.skip import SkipTest |
|
4 | 4 | |
|
5 | 5 | |
|
6 | 6 | class TestSearchController(TestController): |
|
7 | 7 | |
|
8 | 8 | def test_index(self): |
|
9 | 9 | self.log_user() |
|
10 | 10 | response = self.app.get(url(controller='search', action='index')) |
|
11 | 11 | |
|
12 | 12 | self.assertTrue('class="small" id="q" name="q" type="text"' in |
|
13 | 13 | response.body) |
|
14 | 14 | # Test response... |
|
15 | 15 | |
|
16 | 16 | def test_empty_search(self): |
|
17 | 17 | if os.path.isdir(self.index_location): |
|
18 | 18 | raise SkipTest('skipped due to existing index') |
|
19 | 19 | else: |
|
20 | 20 | self.log_user() |
|
21 | 21 | response = self.app.get(url(controller='search', action='index'), |
|
22 | 22 | {'q': HG_REPO}) |
|
23 | 23 | self.assertTrue('There is no index to search in. ' |
|
24 | 24 | 'Please run whoosh indexer' in response.body) |
|
25 | 25 | |
|
26 | 26 | def test_normal_search(self): |
|
27 | 27 | self.log_user() |
|
28 | 28 | response = self.app.get(url(controller='search', action='index'), |
|
29 | 29 | {'q': 'def repo'}) |
|
30 | 30 | response.mustcontain('39 results') |
|
31 | 31 | |
|
32 | 32 | def test_repo_search(self): |
|
33 | 33 | self.log_user() |
|
34 | 34 | response = self.app.get(url(controller='search', action='index'), |
|
35 | 35 | {'q': 'repository:%s def test' % HG_REPO}) |
|
36 | 36 | |
|
37 | 37 | response.mustcontain('4 results') |
|
38 | 38 | |
|
39 | 39 | def test_search_last(self): |
|
40 | 40 | self.log_user() |
|
41 | 41 | response = self.app.get(url(controller='search', action='index'), |
|
42 | 42 | {'q': 'last:t', 'type': 'commit'}) |
|
43 | 43 | |
|
44 | 44 | response.mustcontain('2 results') |
|
45 | 45 | |
|
46 | 46 | def test_search_commit_message(self): |
|
47 | 47 | self.log_user() |
|
48 | 48 | response = self.app.get(url(controller='search', action='index'), |
|
49 | 49 | {'q': 'bother to ask where to fetch repo during tests', |
|
50 | 50 | 'type': 'commit'}) |
|
51 | 51 | |
|
52 | 52 | response.mustcontain('2 results') |
|
53 | 53 | response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1') |
|
54 | 54 | response.mustcontain('c6eb379775c578a95dad8ddab53f963b80894850') |
|
55 | 55 | |
|
56 | 56 | def test_search_commit_message_hg_repo(self): |
|
57 | 57 | self.log_user() |
|
58 | 58 | response = self.app.get(url(controller='search', action='index', |
|
59 |
|
|
|
59 | repo_name=HG_REPO), | |
|
60 | 60 | {'q': 'bother to ask where to fetch repo during tests', |
|
61 | 61 | 'type': 'commit'}) |
|
62 | 62 | |
|
63 | 63 | response.mustcontain('1 results') |
|
64 | 64 | response.mustcontain('a00c1b6f5d7a6ae678fd553a8b81d92367f7ecf1') |
|
65 | 65 | |
|
66 | 66 | def test_search_commit_changed_file(self): |
|
67 | 67 | self.log_user() |
|
68 | 68 | response = self.app.get(url(controller='search', action='index'), |
|
69 | 69 | {'q': 'changed:tests/utils.py', |
|
70 | 70 | 'type': 'commit'}) |
|
71 | 71 | |
|
72 | 72 | response.mustcontain('20 results') |
|
73 | 73 | |
|
74 | 74 | def test_search_commit_changed_files_get_commit(self): |
|
75 | 75 | self.log_user() |
|
76 | 76 | response = self.app.get(url(controller='search', action='index'), |
|
77 | 77 | {'q': 'changed:vcs/utils/lazy.py', |
|
78 | 78 | 'type': 'commit'}) |
|
79 | 79 | |
|
80 | 80 | response.mustcontain('7 results') |
|
81 | 81 | response.mustcontain('36e0fc9d2808c5022a24f49d6658330383ed8666') |
|
82 | 82 | response.mustcontain('af182745859d779f17336241a0815d15166ae1ee') |
|
83 | 83 | response.mustcontain('17438a11f72b93f56d0e08e7d1fa79a378578a82') |
|
84 | 84 | response.mustcontain('33fa3223355104431402a888fa77a4e9956feb3e') |
|
85 | 85 | response.mustcontain('d1f898326327e20524fe22417c22d71064fe54a1') |
|
86 | 86 | response.mustcontain('fe568b4081755c12abf6ba673ba777fc02a415f3') |
|
87 | 87 | response.mustcontain('bafe786f0d8c2ff7da5c1dcfcfa577de0b5e92f1') |
|
88 | 88 | |
|
89 | 89 | def test_search_commit_added_file(self): |
|
90 | 90 | self.log_user() |
|
91 | 91 | response = self.app.get(url(controller='search', action='index'), |
|
92 | 92 | {'q': 'added:README.rst', |
|
93 | 93 | 'type': 'commit'}) |
|
94 | 94 | |
|
95 | 95 | response.mustcontain('2 results') |
|
96 | 96 | #HG |
|
97 | 97 | response.mustcontain('3803844fdbd3b711175fc3da9bdacfcd6d29a6fb') |
|
98 | 98 | #GIT |
|
99 | 99 | response.mustcontain('ff7ca51e58c505fec0dd2491de52c622bb7a806b') |
|
100 | 100 | |
|
101 | 101 | def test_search_author(self): |
|
102 | 102 | self.log_user() |
|
103 | 103 | response = self.app.get(url(controller='search', action='index'), |
|
104 | 104 | {'q': 'author:marcin@python-blog.com raw_id:b986218ba1c9b0d6a259fac9b050b1724ed8e545', |
|
105 | 105 | 'type': 'commit'}) |
|
106 | 106 | |
|
107 | 107 | response.mustcontain('1 results') |
|
108 | 108 | |
|
109 | 109 | def test_search_file_name(self): |
|
110 | 110 | self.log_user() |
|
111 | 111 | response = self.app.get(url(controller='search', action='index'), |
|
112 | 112 | {'q': 'README.rst', 'type': 'path'}) |
|
113 | 113 | |
|
114 | 114 | response.mustcontain('2 results') |
@@ -1,121 +1,121 b'' | |||
|
1 | 1 | from rhodecode.tests import * |
|
2 | 2 | from rhodecode.model.db import Repository |
|
3 | 3 | from rhodecode.lib.utils import invalidate_cache |
|
4 | 4 | from rhodecode.model.repo import RepoModel |
|
5 | 5 | from rhodecode.tests.models.common import _make_repo |
|
6 | 6 | from rhodecode.model.meta import Session |
|
7 | 7 | |
|
8 | 8 | |
|
9 | 9 | class TestSummaryController(TestController): |
|
10 | 10 | |
|
11 | 11 | def test_index(self): |
|
12 | 12 | self.log_user() |
|
13 | 13 | ID = Repository.get_by_repo_name(HG_REPO).repo_id |
|
14 | 14 | response = self.app.get(url(controller='summary', |
|
15 | 15 | action='index', |
|
16 | 16 | repo_name=HG_REPO)) |
|
17 | 17 | |
|
18 | 18 | #repo type |
|
19 | 19 | response.mustcontain( |
|
20 | 20 | """<img style="margin-bottom:2px" class="icon" """ |
|
21 | 21 | """title="Mercurial repository" alt="Mercurial repository" """ |
|
22 | 22 | """src="/images/icons/hgicon.png"/>""" |
|
23 | 23 | ) |
|
24 | 24 | response.mustcontain( |
|
25 | 25 | """<img style="margin-bottom:2px" class="icon" """ |
|
26 | 26 | """title="public repository" alt="public """ |
|
27 | 27 | """repository" src="/images/icons/lock_open.png"/>""" |
|
28 | 28 | ) |
|
29 | 29 | |
|
30 | 30 | #codes stats |
|
31 | 31 | self._enable_stats() |
|
32 | 32 | |
|
33 | 33 | invalidate_cache('get_repo_cached_%s' % HG_REPO) |
|
34 | 34 | response = self.app.get(url(controller='summary', action='index', |
|
35 | 35 | repo_name=HG_REPO)) |
|
36 | 36 | response.mustcontain( |
|
37 | 37 | """var data = [["py", {"count": 42, "desc": ["Python"]}], """ |
|
38 | 38 | """["rst", {"count": 11, "desc": ["Rst"]}], """ |
|
39 | 39 | """["sh", {"count": 2, "desc": ["Bash"]}], """ |
|
40 | 40 | """["makefile", {"count": 1, "desc": ["Makefile", "Makefile"]}],""" |
|
41 | 41 | """ ["cfg", {"count": 1, "desc": ["Ini"]}], """ |
|
42 | 42 | """["css", {"count": 1, "desc": ["Css"]}], """ |
|
43 | 43 | """["bat", {"count": 1, "desc": ["Batch"]}]];""" |
|
44 | 44 | ) |
|
45 | 45 | |
|
46 | 46 | # clone url... |
|
47 |
response.mustcontain( |
|
|
48 |
response.mustcontain( |
|
|
47 | response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % HG_REPO) | |
|
48 | response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID) | |
|
49 | 49 | |
|
50 | 50 | def test_index_git(self): |
|
51 | 51 | self.log_user() |
|
52 | 52 | ID = Repository.get_by_repo_name(GIT_REPO).repo_id |
|
53 | 53 | response = self.app.get(url(controller='summary', |
|
54 | 54 | action='index', |
|
55 | 55 | repo_name=GIT_REPO)) |
|
56 | 56 | |
|
57 | 57 | #repo type |
|
58 | 58 | response.mustcontain( |
|
59 | 59 | """<img style="margin-bottom:2px" class="icon" """ |
|
60 | 60 | """title="Git repository" alt="Git repository" """ |
|
61 | 61 | """src="/images/icons/giticon.png"/>""" |
|
62 | 62 | ) |
|
63 | 63 | response.mustcontain( |
|
64 | 64 | """<img style="margin-bottom:2px" class="icon" """ |
|
65 | 65 | """title="public repository" alt="public """ |
|
66 | 66 | """repository" src="/images/icons/lock_open.png"/>""" |
|
67 | 67 | ) |
|
68 | 68 | |
|
69 | 69 | # clone url... |
|
70 |
response.mustcontain( |
|
|
71 |
response.mustcontain( |
|
|
70 | response.mustcontain('''id="clone_url" readonly="readonly" value="http://test_admin@localhost:80/%s"''' % GIT_REPO) | |
|
71 | response.mustcontain('''id="clone_url_id" readonly="readonly" value="http://test_admin@localhost:80/_%s"''' % ID) | |
|
72 | 72 | |
|
73 | 73 | def test_index_by_id_hg(self): |
|
74 | 74 | self.log_user() |
|
75 | 75 | ID = Repository.get_by_repo_name(HG_REPO).repo_id |
|
76 | 76 | response = self.app.get(url(controller='summary', |
|
77 | 77 | action='index', |
|
78 | 78 | repo_name='_%s' % ID)) |
|
79 | 79 | |
|
80 | 80 | #repo type |
|
81 | 81 | response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ |
|
82 | 82 | """title="Mercurial repository" alt="Mercurial """ |
|
83 | 83 | """repository" src="/images/icons/hgicon.png"/>""") |
|
84 | 84 | response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ |
|
85 | 85 | """title="public repository" alt="public """ |
|
86 | 86 | """repository" src="/images/icons/lock_open.png"/>""") |
|
87 | 87 | |
|
88 | 88 | def test_index_by_repo_having_id_path_in_name_hg(self): |
|
89 | 89 | self.log_user() |
|
90 | 90 | _make_repo(name='repo_1') |
|
91 | 91 | Session().commit() |
|
92 | 92 | response = self.app.get(url(controller='summary', |
|
93 | 93 | action='index', |
|
94 | 94 | repo_name='repo_1')) |
|
95 | 95 | |
|
96 | 96 | try: |
|
97 | 97 | response.mustcontain("""repo_1""") |
|
98 | 98 | finally: |
|
99 | 99 | RepoModel().delete(Repository.get_by_repo_name('repo_1')) |
|
100 | 100 | Session().commit() |
|
101 | 101 | |
|
102 | 102 | def test_index_by_id_git(self): |
|
103 | 103 | self.log_user() |
|
104 | 104 | ID = Repository.get_by_repo_name(GIT_REPO).repo_id |
|
105 | 105 | response = self.app.get(url(controller='summary', |
|
106 | 106 | action='index', |
|
107 | 107 | repo_name='_%s' % ID)) |
|
108 | 108 | |
|
109 | 109 | #repo type |
|
110 | 110 | response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ |
|
111 | 111 | """title="Git repository" alt="Git """ |
|
112 | 112 | """repository" src="/images/icons/giticon.png"/>""") |
|
113 | 113 | response.mustcontain("""<img style="margin-bottom:2px" class="icon" """ |
|
114 | 114 | """title="public repository" alt="public """ |
|
115 | 115 | """repository" src="/images/icons/lock_open.png"/>""") |
|
116 | 116 | |
|
117 | 117 | def _enable_stats(self): |
|
118 | 118 | r = Repository.get_by_repo_name(HG_REPO) |
|
119 | 119 | r.enable_statistics = True |
|
120 | 120 | self.Session.add(r) |
|
121 | 121 | self.Session.commit() |
General Comments 0
You need to be logged in to leave comments.
Login now