Mercurial > kallithea
comparison rhodecode/tests/functional/test_forks.py @ 1723:64e91067b996 beta
- refactoring to overcome poor usage of global pylons config
- db transaction fixes
- fixed tests
- garden
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 26 Nov 2011 02:16:21 +0200 |
parents | f9559677c953 |
children | 8321b3d19b1f |
comparison
equal
deleted
inserted
replaced
1722:e7eef7a1db6a | 1723:64e91067b996 |
---|---|
18 | 18 |
19 # create a fork | 19 # create a fork |
20 fork_name = HG_FORK | 20 fork_name = HG_FORK |
21 description = 'fork of vcs test' | 21 description = 'fork of vcs test' |
22 repo_name = HG_REPO | 22 repo_name = HG_REPO |
23 response = self.app.post(url(controller='settings', | 23 org_repo = Repository.get_by_repo_name(repo_name) |
24 response = self.app.post(url(controller='forks', | |
24 action='fork_create', | 25 action='fork_create', |
25 repo_name=repo_name), | 26 repo_name=repo_name), |
26 {'fork_name':fork_name, | 27 {'repo_name':fork_name, |
28 'repo_group':'', | |
29 'fork_parent_id':org_repo.repo_id, | |
27 'repo_type':'hg', | 30 'repo_type':'hg', |
28 'description':description, | 31 'description':description, |
29 'private':'False'}) | 32 'private':'False'}) |
30 | 33 |
31 response = self.app.get(url(controller='forks', action='forks', | 34 response = self.app.get(url(controller='forks', action='forks', |
37 in response.body) | 40 in response.body) |
38 | 41 |
39 #remove this fork | 42 #remove this fork |
40 response = self.app.delete(url('repo', repo_name=fork_name)) | 43 response = self.app.delete(url('repo', repo_name=fork_name)) |
41 | 44 |
45 | |
46 | |
47 | |
48 def test_z_fork_create(self): | |
49 self.log_user() | |
50 fork_name = HG_FORK | |
51 description = 'fork of vcs test' | |
52 repo_name = HG_REPO | |
53 org_repo = Repository.get_by_repo_name(repo_name) | |
54 response = self.app.post(url(controller='forks', action='fork_create', | |
55 repo_name=repo_name), | |
56 {'repo_name':fork_name, | |
57 'repo_group':'', | |
58 'fork_parent_id':org_repo.repo_id, | |
59 'repo_type':'hg', | |
60 'description':description, | |
61 'private':'False'}) | |
62 | |
63 #test if we have a message that fork is ok | |
64 self.assertTrue('forked %s repository as %s' \ | |
65 % (repo_name, fork_name) in response.session['flash'][0]) | |
66 | |
67 #test if the fork was created in the database | |
68 fork_repo = self.Session().query(Repository)\ | |
69 .filter(Repository.repo_name == fork_name).one() | |
70 | |
71 self.assertEqual(fork_repo.repo_name, fork_name) | |
72 self.assertEqual(fork_repo.fork.repo_name, repo_name) | |
73 | |
74 | |
75 #test if fork is visible in the list ? | |
76 response = response.follow() | |
77 | |
78 | |
79 #check if fork is marked as fork | |
80 response = self.app.get(url(controller='summary', action='index', | |
81 repo_name=fork_name)) | |
82 | |
83 self.assertTrue('Fork of %s' % repo_name in response.body) |