Mercurial > kallithea
annotate rhodecode/tests/functional/test_admin_repos.py @ 1718:f78bee8eec78 beta
reduce cookie size for better support of client side sessions
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Fri, 25 Nov 2011 19:25:10 +0200 |
parents | 54687aa00724 |
children | 8ecc6b8229a5 |
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}) |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
35 |
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
36 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
|
37 |
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
|
38 #test if the repo was created in the database |
1713
54687aa00724
Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
1398
diff
changeset
|
39 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
|
40 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
|
41 |
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
|
42 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
|
43 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
|
44 |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
45 #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
|
46 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
|
47 |
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
|
48 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
|
49 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
50 |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
51 #test if repository was created on filesystem |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
52 try: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
53 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
|
54 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
|
55 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
|
56 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
57 |
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
58 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
|
59 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
|
60 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 = "%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
|
62 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
|
63 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
|
64 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
|
65 private = False |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
66 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
|
67 '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
|
68 'clone_uri':'', |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
69 'repo_group':'', |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
70 'description':description, |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
71 'private':private}) |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
72 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
|
73 '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
|
74 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
75 #test if the repo was created in the database |
1713
54687aa00724
Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
1398
diff
changeset
|
76 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
|
77 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
|
78 |
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.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
|
80 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
|
81 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
82 #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
|
83 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
|
84 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
85 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
|
86 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
87 #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
|
88 try: |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
89 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
|
90 except: |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
91 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
|
92 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
93 |
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
|
94 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
|
95 #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
|
96 pass |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
97 |
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 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
|
99 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
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 '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
|
106 '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
|
107 '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
|
108 '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
|
109 '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
|
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 |
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 #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
|
113 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
|
114 |
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 #test if the fork was created in the database |
1713
54687aa00724
Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
1398
diff
changeset
|
116 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
|
117 |
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.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
|
119 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
|
120 |
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 #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
|
122 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
|
123 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
124 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
|
125 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
126 #test if repository was created on filesystem |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
127 try: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
128 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
|
129 except: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
130 assert False , 'no repo in filesystem' |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
131 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
132 def test_new(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
133 self.log_user() |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
134 response = self.app.get(url('new_repo')) |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
135 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
136 def test_new_as_xml(self): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
137 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
|
138 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
139 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
|
140 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
|
141 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
142 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
|
143 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
|
144 params=dict(_method='put')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
145 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
146 def test_delete(self): |
628 | 147 self.log_user() |
148 repo_name = 'vcs_test_new_to_delete' | |
149 description = 'description for newly created repo' | |
150 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
|
151 |
628 | 152 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
|
153 '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
|
154 '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
|
155 '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
|
156 '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
|
157 '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
|
158 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
|
159 |
628 | 160 #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
|
161 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
|
162 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
|
163 |
628 | 164 #test if the repo was created in the database |
1713
54687aa00724
Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
1398
diff
changeset
|
165 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
|
166 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
|
167 |
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
|
168 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
|
169 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
|
170 |
628 | 171 #test if repository is visible in the list ? |
172 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
|
173 |
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
|
174 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
|
175 |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
176 |
628 | 177 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
|
178 |
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
|
179 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
|
180 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
|
181 |
628 | 182 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
|
183 |
628 | 184 #check if repo was deleted from db |
1713
54687aa00724
Tests updates, Session refactoring
Marcin Kuzminski <marcin@python-works.com>
parents:
1398
diff
changeset
|
185 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
|
186 == 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
|
187 |
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
|
188 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
|
189 |
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
|
190 |
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 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
|
192 #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
|
193 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
|
194 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
195 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
196 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
|
197 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
|
198 params=dict(_method='delete')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
199 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
200 def test_show(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
201 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
|
202 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
|
203 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
204 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
|
205 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
|
206 format='xml')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
207 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
208 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
|
209 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
|
210 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
211 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
|
212 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
|
213 format='xml')) |