Mercurial > kallithea
annotate rhodecode/tests/functional/test_admin_repos.py @ 1749:8ecc6b8229a5 beta
commit less models
- models don't do any commits(with few exceptions)
- all db transactions should be handled by higher level modules like controllers, celery tasks
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 02 Dec 2011 22:31:13 +0200 |
parents | 54687aa00724 |
children | 324ac367a4da |
rev | line source |
---|---|
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
1 # -*- coding: utf-8 -*- |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
2 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
3 import os |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
4 import vcs |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
5 |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
6 from rhodecode.model.db import Repository |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
7 from rhodecode.tests import * |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
8 |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
9 class TestAdminReposController(TestController): |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
10 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
11 |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
12 def __make_repo(self): |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
13 pass |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
14 |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
15 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
16 def test_index(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
17 self.log_user() |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
18 response = self.app.get(url('repos')) |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
19 # Test response... |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
20 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
21 def test_index_as_xml(self): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
22 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
|
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 def test_create_hg(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
25 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
|
26 repo_name = NEW_HG_REPO |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
27 description = 'description for newly created repo' |
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
28 private = False |
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
29 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
|
30 'repo_type':'hg', |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
31 'clone_uri':'', |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
32 'repo_group':'', |
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 '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
|
34 'private':private}) |
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
35 self.checkSessionFlash(response, 'created repository %s' % (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
|
36 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
37 #test if the repo was created in the database |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1713
diff
changeset
|
38 new_repo = self.Session.query(Repository).filter(Repository.repo_name == |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
39 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
|
40 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
41 self.assertEqual(new_repo.repo_name, repo_name) |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
42 self.assertEqual(new_repo.description, 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
|
43 |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
44 #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
|
45 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
|
46 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
47 self.assertTrue(repo_name in response.body) |
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
|
48 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
49 |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
50 #test if repository was created on filesystem |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
51 try: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
52 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
53 except: |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
54 self.fail('no repo in filesystem') |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
55 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
56 |
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
57 def test_create_hg_non_ascii(self): |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
58 self.log_user() |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
59 non_ascii = "ąęł" |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
60 repo_name = "%s%s" % (NEW_HG_REPO, non_ascii) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
61 repo_name_unicode = repo_name.decode('utf8') |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
62 description = 'description for newly created repo' + non_ascii |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
63 description_unicode = description.decode('utf8') |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
64 private = False |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
65 response = self.app.post(url('repos'), {'repo_name':repo_name, |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
66 'repo_type':'hg', |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
67 'clone_uri':'', |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
68 'repo_group':'', |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
69 'description':description, |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
70 'private':private}) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
71 self.checkSessionFlash(response, |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
72 'created repository %s' % (repo_name_unicode)) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
73 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
74 #test if the repo was created in the database |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1713
diff
changeset
|
75 new_repo = self.Session.query(Repository).filter(Repository.repo_name == |
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
76 repo_name_unicode).one() |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
77 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
78 self.assertEqual(new_repo.repo_name, repo_name_unicode) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
79 self.assertEqual(new_repo.description, description_unicode) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
80 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
81 #test if repository is visible in the list ? |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
82 response = response.follow() |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
83 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
84 self.assertTrue(repo_name in response.body) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
85 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
86 #test if repository was created on filesystem |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
87 try: |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
88 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
89 except: |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
90 self.fail('no repo in filesystem') |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
91 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
92 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
93 def test_create_hg_in_group(self): |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
94 #TODO: write test ! |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
95 pass |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
96 |
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
|
97 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 'repo_type':'git', |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
105 'clone_uri':'', |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
106 'repo_group':'', |
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
|
107 '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
|
108 '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
|
109 |
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 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
111 #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
|
112 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
|
113 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
114 #test if the fork was created in the database |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1713
diff
changeset
|
115 new_repo = self.Session.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
|
116 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
117 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
|
118 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
|
119 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
120 #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
|
121 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
|
122 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
123 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
|
124 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
125 #test if repository was created on filesystem |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
126 try: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
127 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
128 except: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
129 assert False , 'no repo in filesystem' |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
130 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
131 def test_new(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
132 self.log_user() |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
133 response = self.app.get(url('new_repo')) |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
134 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
135 def test_new_as_xml(self): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
136 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
|
137 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
138 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
|
139 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
|
140 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
141 def test_update_browser_fakeout(self): |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
142 response = self.app.post(url('repo', repo_name=HG_REPO), |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
143 params=dict(_method='put')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
144 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
145 def test_delete(self): |
628 | 146 self.log_user() |
147 repo_name = 'vcs_test_new_to_delete' | |
148 description = 'description for newly created repo' | |
149 private = False | |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
150 |
628 | 151 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
|
152 'repo_type':'hg', |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
153 'clone_uri':'', |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
154 'repo_group':'', |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
155 'description':description, |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
156 'private':private}) |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
157 self.assertTrue('flash' in response.session) |
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
|
158 |
628 | 159 #test if we have a message for that repository |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
160 self.assertTrue('''created repository %s''' % (repo_name) in |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
161 response.session['flash'][0]) |
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
|
162 |
628 | 163 #test if the repo was created in the database |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1713
diff
changeset
|
164 new_repo = self.Session.query(Repository).filter(Repository.repo_name == |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
165 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
|
166 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
167 self.assertEqual(new_repo.repo_name, repo_name) |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
168 self.assertEqual(new_repo.description, 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
|
169 |
628 | 170 #test if repository is visible in the list ? |
171 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
|
172 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
173 self.assertTrue(repo_name in response.body) |
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
|
174 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
175 |
628 | 176 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
|
177 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
178 self.assertTrue('''deleted repository %s''' % (repo_name) in |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
179 response.session['flash'][0]) |
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
|
180 |
628 | 181 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
|
182 |
628 | 183 #check if repo was deleted from db |
1749
8ecc6b8229a5
commit less models
Marcin Kuzminski <marcin@python-works.com>
parents:
1713
diff
changeset
|
184 deleted_repo = self.Session.query(Repository).filter(Repository.repo_name |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
185 == repo_name).scalar() |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
186 |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
187 self.assertEqual(deleted_repo, None) |
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
|
188 |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
189 |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
190 def test_delete_repo_with_group(self): |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
191 #TODO: |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
192 pass |
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
|
193 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
194 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
195 def test_delete_browser_fakeout(self): |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
196 response = self.app.post(url('repo', repo_name=HG_REPO), |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
197 params=dict(_method='delete')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
198 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
199 def test_show(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
200 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
|
201 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
|
202 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
203 def test_show_as_xml(self): |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
204 response = self.app.get(url('formatted_repo', repo_name=HG_REPO, |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
205 format='xml')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
206 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
207 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
|
208 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
|
209 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
210 def test_edit_as_xml(self): |
1366
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
211 response = self.app.get(url('formatted_edit_repo', repo_name=HG_REPO, |
9c0f5d558789
fixes #200, rewrote the whole caching mechanism to get rid of such problems. Now cached instances are attached
Marcin Kuzminski <marcin@python-works.com>
parents:
1037
diff
changeset
|
212 format='xml')) |