annotate rhodecode/tests/functional/test_admin_repos.py @ 1057:af6ca51fb80f

rhodecode release 1.1.3 changes
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 16 Feb 2011 11:05:35 +0100
parents f1629c0c28cc
children b1d6478d4561
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
1 from rhodecode.model.db import Repository
547
1e757ac98988 renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents: 459
diff changeset
2 from rhodecode.tests import *
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
3
691
7486da5f0628 Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents: 688
diff changeset
4 class TestAdminReposController(TestController):
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
5
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
6 def test_index(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
7 self.log_user()
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
8 response = self.app.get(url('repos'))
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
9 # Test response...
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
10
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
11 def test_index_as_xml(self):
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
12 response = self.app.get(url('formatted_repos', format='xml'))
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
13
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
14 def test_create_hg(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
15 self.log_user()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
16 repo_name = NEW_HG_REPO
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
17 description = 'description for newly created repo'
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
18 private = False
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
19 response = self.app.post(url('repos'), {'repo_name':repo_name,
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
20 'repo_type':'hg',
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
21 'description':description,
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
22 'private':private})
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
23
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
24
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
25 #test if we have a message for that repository
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
26 assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
27
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
28 #test if the fork was created in the database
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
29 new_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).one()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
30
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
31 assert new_repo.repo_name == repo_name, 'wrong name of repo name in db'
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
32 assert new_repo.description == description, 'wrong description'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
33
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
34 #test if repository is visible in the list ?
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
35 response = response.follow()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
36
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
37 assert repo_name in response.body, 'missing new repo from the main repos list'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
38
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
39 def test_create_git(self):
728
f1629c0c28cc fixed bug in forms found due to testing,
Marcin Kuzminski <marcin@python-works.com>
parents: 691
diff changeset
40 return
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
41 self.log_user()
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
42 repo_name = NEW_GIT_REPO
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
43 description = 'description for newly created repo'
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
44 private = False
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
45 response = self.app.post(url('repos'), {'repo_name':repo_name,
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
46 'repo_type':'git',
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
47 'description':description,
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
48 'private':private})
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
49
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
50
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
51 #test if we have a message for that repository
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
52 assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo'
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
53
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
54 #test if the fork was created in the database
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
55 new_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).one()
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
56
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
57 assert new_repo.repo_name == repo_name, 'wrong name of repo name in db'
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
58 assert new_repo.description == description, 'wrong description'
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
59
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
60 #test if repository is visible in the list ?
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
61 response = response.follow()
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
62
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
63 assert repo_name in response.body, 'missing new repo from the main repos list'
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
64
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
65
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
66 def test_new(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
67 self.log_user()
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
68 response = self.app.get(url('new_repo'))
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
69
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
70 def test_new_as_xml(self):
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
71 response = self.app.get(url('formatted_new_repo', format='xml'))
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
72
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
73 def test_update(self):
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
74 response = self.app.put(url('repo', repo_name=HG_REPO))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
75
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
76 def test_update_browser_fakeout(self):
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
77 response = self.app.post(url('repo', repo_name=HG_REPO), params=dict(_method='put'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
78
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
79 def test_delete(self):
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
80 self.log_user()
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
81 repo_name = 'vcs_test_new_to_delete'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
82 description = 'description for newly created repo'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
83 private = False
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
84 response = self.app.post(url('repos'), {'repo_name':repo_name,
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
85 'repo_type':'hg',
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
86 'description':description,
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
87 'private':private})
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
88
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
89
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
90 #test if we have a message for that repository
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
91 assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
92
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
93 #test if the repo was created in the database
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
94 new_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).one()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
95
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
96 assert new_repo.repo_name == repo_name, 'wrong name of repo name in db'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
97 assert new_repo.description == description, 'wrong description'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
98
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
99 #test if repository is visible in the list ?
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
100 response = response.follow()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
101
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
102 assert repo_name in response.body, 'missing new repo from the main repos list'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
103
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
104
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
105 response = self.app.delete(url('repo', repo_name=repo_name))
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
106
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
107 assert '''deleted repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about delete repo'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
108
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
109 response.follow()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
110
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
111 #check if repo was deleted from db
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
112 deleted_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).scalar()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
113
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
114 assert deleted_repo is None, 'Deleted repository was found in db'
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
115
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
116
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
117 def test_delete_browser_fakeout(self):
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
118 response = self.app.post(url('repo', repo_name=HG_REPO), params=dict(_method='delete'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
119
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
120 def test_show(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
121 self.log_user()
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
122 response = self.app.get(url('repo', repo_name=HG_REPO))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
123
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
124 def test_show_as_xml(self):
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
125 response = self.app.get(url('formatted_repo', repo_name=HG_REPO, format='xml'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
126
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
127 def test_edit(self):
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
128 response = self.app.get(url('edit_repo', repo_name=HG_REPO))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
129
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
130 def test_edit_as_xml(self):
688
8acbfa837180 Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents: 628
diff changeset
131 response = self.app.get(url('formatted_edit_repo', repo_name=HG_REPO, format='xml'))