Mercurial > kallithea
annotate rhodecode/tests/functional/test_forks.py @ 2679:dffb92224edf beta
removed ftp from allowed schemas
- added tests for the schemas fix
- moved parsing url if we only have came_from present
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Tue, 31 Jul 2012 12:15:54 +0200 |
parents | 388843a3a3c0 |
children | d2d35cf2b351 |
rev | line source |
---|---|
1375
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
1 from rhodecode.tests import * |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
2 |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
3 from rhodecode.model.db import Repository |
2176
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
4 from rhodecode.model.repo import RepoModel |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
5 from rhodecode.model.user import UserModel |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
6 |
1375
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
7 |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
8 class TestForksController(TestController): |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
9 |
2176
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
10 def setUp(self): |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
11 self.username = u'forkuser' |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
12 self.password = u'qweqwe' |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
13 self.u1 = UserModel().create_or_update( |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
14 username=self.username, password=self.password, |
2513
388843a3a3c0
Updated create_or_update method to not change API key when password is not updated
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
15 email=u'fork_king@rhodecode.org', firstname=u'u1', lastname=u'u1' |
2176
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
16 ) |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
17 self.Session.commit() |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
18 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
19 def tearDown(self): |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
20 self.Session.delete(self.u1) |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
21 self.Session.commit() |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
22 |
1375
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
23 def test_index(self): |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
24 self.log_user() |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
25 repo_name = HG_REPO |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
26 response = self.app.get(url(controller='forks', action='forks', |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
27 repo_name=repo_name)) |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
28 |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
29 self.assertTrue("""There are no forks yet""" in response.body) |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
30 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
31 def test_index_with_fork_hg(self): |
1375
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
32 self.log_user() |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
33 |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
34 # create a fork |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
35 fork_name = HG_FORK |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
36 description = 'fork of vcs test' |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
37 repo_name = HG_REPO |
1723
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
38 org_repo = Repository.get_by_repo_name(repo_name) |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
39 response = self.app.post(url(controller='forks', |
1375
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
40 action='fork_create', |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
41 repo_name=repo_name), |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
42 {'repo_name': fork_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
43 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
44 'fork_parent_id': org_repo.repo_id, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
45 'repo_type': 'hg', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
46 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
47 'private': 'False', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
48 'landing_rev': 'tip'}) |
1375
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
49 |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
50 response = self.app.get(url(controller='forks', action='forks', |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
51 repo_name=repo_name)) |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
52 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
53 response.mustcontain( |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
54 """<a href="/%s/summary">%s</a>""" % (fork_name, fork_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
55 ) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
56 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
57 #remove this fork |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
58 response = self.app.delete(url('repo', repo_name=fork_name)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
59 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
60 def test_index_with_fork_git(self): |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
61 self.log_user() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
62 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
63 # create a fork |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
64 fork_name = GIT_FORK |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
65 description = 'fork of vcs test' |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
66 repo_name = GIT_REPO |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
67 org_repo = Repository.get_by_repo_name(repo_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
68 response = self.app.post(url(controller='forks', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
69 action='fork_create', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
70 repo_name=repo_name), |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
71 {'repo_name': fork_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
72 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
73 'fork_parent_id': org_repo.repo_id, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
74 'repo_type': 'git', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
75 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
76 'private': 'False', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
77 'landing_rev': 'tip'}) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
78 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
79 response = self.app.get(url(controller='forks', action='forks', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
80 repo_name=repo_name)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
81 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
82 response.mustcontain( |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
83 """<a href="/%s/summary">%s</a>""" % (fork_name, fork_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
84 ) |
1375
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
85 |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
86 #remove this fork |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
87 response = self.app.delete(url('repo', repo_name=fork_name)) |
f9559677c953
added tests for forks and followers pages
Marcin Kuzminski <marcin@python-works.com>
parents:
diff
changeset
|
88 |
1723
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
89 def test_z_fork_create(self): |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
90 self.log_user() |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
91 fork_name = HG_FORK |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
92 description = 'fork of vcs test' |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
93 repo_name = HG_REPO |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
94 org_repo = Repository.get_by_repo_name(repo_name) |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
95 response = self.app.post(url(controller='forks', action='fork_create', |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
96 repo_name=repo_name), |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
97 {'repo_name':fork_name, |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
98 'repo_group':'', |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
99 'fork_parent_id':org_repo.repo_id, |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
100 'repo_type':'hg', |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
101 'description':description, |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
102 'private':'False', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
103 'landing_rev': 'tip'}) |
1723
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
104 |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
105 #test if we have a message that fork is ok |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
106 self.checkSessionFlash(response, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2176
diff
changeset
|
107 'forked %s repository as %s' % (repo_name, fork_name)) |
1723
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
108 |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
109 #test if the fork was created in the database |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1732
diff
changeset
|
110 fork_repo = self.Session.query(Repository)\ |
1723
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
111 .filter(Repository.repo_name == fork_name).one() |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
112 |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
113 self.assertEqual(fork_repo.repo_name, fork_name) |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
114 self.assertEqual(fork_repo.fork.repo_name, repo_name) |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
115 |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
116 #test if fork is visible in the list ? |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
117 response = response.follow() |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
118 |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
119 response = self.app.get(url(controller='summary', action='index', |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
120 repo_name=fork_name)) |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
121 |
64e91067b996
- refactoring to overcome poor usage of global pylons config
Marcin Kuzminski <marcin@python-works.com>
parents:
1375
diff
changeset
|
122 self.assertTrue('Fork of %s' % repo_name in response.body) |
2176
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
123 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
124 def test_zz_fork_permission_page(self): |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
125 usr = self.log_user(self.username, self.password)['user_id'] |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
126 repo_name = HG_REPO |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
127 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
128 forks = self.Session.query(Repository)\ |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
129 .filter(Repository.fork_id != None)\ |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
130 .all() |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
131 self.assertEqual(1, len(forks)) |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
132 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
133 # set read permissions for this |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
134 RepoModel().grant_user_permission(repo=forks[0], |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
135 user=usr, |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
136 perm='repository.read') |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
137 self.Session.commit() |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
138 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
139 response = self.app.get(url(controller='forks', action='forks', |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
140 repo_name=repo_name)) |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
141 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
142 response.mustcontain('<div style="padding:5px 3px 3px 42px;">fork of vcs test</div>') |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
143 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
144 def test_zzz_fork_permission_page(self): |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
145 usr = self.log_user(self.username, self.password)['user_id'] |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
146 repo_name = HG_REPO |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
147 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
148 forks = self.Session.query(Repository)\ |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
149 .filter(Repository.fork_id != None)\ |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
150 .all() |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
151 self.assertEqual(1, len(forks)) |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
152 |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
153 # set none |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
154 RepoModel().grant_user_permission(repo=forks[0], |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
155 user=usr, perm='repository.none') |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
156 self.Session.commit() |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
157 # fork shouldn't be there |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
158 response = self.app.get(url(controller='forks', action='forks', |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
159 repo_name=repo_name)) |
162bf5c978f8
fixed missing permissions check on forks page
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
160 response.mustcontain('There are no forks yet') |