annotate rhodecode/tests/functional/test_repos.py @ 634:0d18cf02278a beta

Added giticon
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 24 Oct 2010 22:29:35 +0200
parents dd06bdf974c8
children 8acbfa837180
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
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
4 class TestReposController(TestController):
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
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
14 def test_create(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
15 self.log_user()
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
16 repo_name = 'vcs_test_new'
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,
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
20 'description':description,
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
21 'private':private})
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
22
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
23 print response
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
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
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
26 print '-' * 100
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
27 print response.session
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
28 assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo'
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
29
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
30 #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
31 new_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).one()
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
32
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
33 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
34 assert new_repo.description == description, 'wrong description'
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
35
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
36 #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
37 response = response.follow()
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
38
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
39 assert repo_name in response.body, 'missing new repo from the main repos list'
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
40
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
41
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
42
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
43
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
44 def test_new(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
45 self.log_user()
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
46 response = self.app.get(url('new_repo'))
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
48 def test_new_as_xml(self):
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
49 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
50
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
51 def test_update(self):
459
7c978511c951 implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents: 47
diff changeset
52 response = self.app.put(url('repo', repo_name='vcs_test'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
53
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
54 def test_update_browser_fakeout(self):
459
7c978511c951 implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents: 47
diff changeset
55 response = self.app.post(url('repo', repo_name='vcs_test'), params=dict(_method='put'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
56
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
57 def test_delete(self):
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
58 self.log_user()
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
59 repo_name = 'vcs_test_new_to_delete'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
60 description = 'description for newly created repo'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
61 private = False
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
62 response = self.app.post(url('repos'), {'repo_name':repo_name,
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
63 'description':description,
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
64 'private':private})
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
65
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
66 print response
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
67
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
68 #test if we have a message for that repository
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
69 print '-' * 100
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
70 print response.session
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
71 assert '''created repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about new repo'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
72
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
73 #test if the repo was created in the database
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
74 new_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).one()
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
75
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
76 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
77 assert new_repo.description == description, 'wrong description'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
78
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
79 #test if repository is visible in the list ?
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
80 response = response.follow()
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
81
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
82 assert repo_name in response.body, 'missing new repo from the main repos list'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
83
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
84
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
85 response = self.app.delete(url('repo', repo_name=repo_name))
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
86
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
87 print '-' * 100
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
88 print response.session
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
89 assert '''deleted repository %s''' % (repo_name) in response.session['flash'][0], 'No flash message about delete repo'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
90
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
91 response.follow()
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
92
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
93 #check if repo was deleted from db
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
94 deleted_repo = self.sa.query(Repository).filter(Repository.repo_name == repo_name).scalar()
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
95
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
96 assert deleted_repo is None, 'Deleted repository was found in db'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
97
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
98
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
99 def test_delete_browser_fakeout(self):
459
7c978511c951 implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents: 47
diff changeset
100 response = self.app.post(url('repo', repo_name='vcs_test'), params=dict(_method='delete'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
101
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
102 def test_show(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
103 self.log_user()
459
7c978511c951 implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents: 47
diff changeset
104 response = self.app.get(url('repo', repo_name='vcs_test'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
105
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
106 def test_show_as_xml(self):
459
7c978511c951 implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents: 47
diff changeset
107 response = self.app.get(url('formatted_repo', repo_name='vcs_test', format='xml'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
108
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
109 def test_edit(self):
459
7c978511c951 implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents: 47
diff changeset
110 response = self.app.get(url('edit_repo', repo_name='vcs_test'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
111
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
112 def test_edit_as_xml(self):
459
7c978511c951 implemented basic (startup) nose test suite.
Marcin Kuzminski <marcin@python-works.com>
parents: 47
diff changeset
113 response = self.app.get(url('formatted_edit_repo', repo_name='vcs_test', format='xml'))