Mercurial > kallithea
annotate rhodecode/tests/functional/test_admin_repos.py @ 2776:63e58ef80ef1
Merge beta branch into stable
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sun, 02 Sep 2012 21:19:54 +0200 |
parents | 40b3a54391f9 |
children | 6104dfd35b16 |
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 |
2007
324ac367a4da
Added VCS into rhodecode core for faster and easier deployments of new versions
Marcin Kuzminski <marcin@python-works.com>
parents:
1749
diff
changeset
|
4 from rhodecode.lib import vcs |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
5 |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
6 from rhodecode.model.db import Repository, RepoGroup |
547
1e757ac98988
renamed project to rhodecode
Marcin Kuzminski <marcin@python-works.com>
parents:
459
diff
changeset
|
7 from rhodecode.tests import * |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
8 from rhodecode.model.repos_group import ReposGroupModel |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
9 from rhodecode.model.repo import RepoModel |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
10 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
11 |
691
7486da5f0628
Refactor codes for scm model
Marcin Kuzminski <marcin@python-works.com>
parents:
688
diff
changeset
|
12 class TestAdminReposController(TestController): |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
13 |
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
|
14 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
|
15 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
|
16 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
17 def test_index(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
18 self.log_user() |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
19 response = self.app.get(url('repos')) |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
20 # Test response... |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
21 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
22 def test_index_as_xml(self): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
23 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
|
24 |
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
|
25 def test_create_hg(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
26 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
|
27 repo_name = NEW_HG_REPO |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
28 description = 'description for newly created repo' |
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
29 private = False |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
30 response = self.app.post(url('repos'), {'repo_name': repo_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
31 'repo_type': 'hg', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
32 'clone_uri': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
33 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
34 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
35 'private': private, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
36 'landing_rev': 'tip'}) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
37 self.checkSessionFlash(response, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
38 '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
|
39 |
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 #test if the repo was created in the database |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
41 new_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
42 .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
|
43 |
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
|
44 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
|
45 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
|
46 |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
47 #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
|
48 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
|
49 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
50 response.mustcontain(repo_name) |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
51 |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
52 #test if repository was created on filesystem |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
53 try: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
54 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
|
55 except: |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
56 self.fail('no repo %s in filesystem' % repo_name) |
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 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
66 response = self.app.post(url('repos'), {'repo_name': repo_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
67 'repo_type': 'hg', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
68 'clone_uri': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
69 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
70 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
71 'private': private, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
72 'landing_rev': 'tip'}) |
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
73 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
|
74 '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
|
75 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
76 #test if the repo was created in the database |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
77 new_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
78 .filter(Repository.repo_name == repo_name_unicode).one() |
1398
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
79 |
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.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
|
81 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
|
82 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
83 #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
|
84 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
|
85 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
86 response.mustcontain(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
|
87 |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
88 #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
|
89 try: |
6dee43453f58
added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents:
1366
diff
changeset
|
90 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
|
91 except: |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
92 self.fail('no repo %s in filesystem' % 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
|
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): |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
95 self.log_user() |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
96 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
97 ## create GROUP |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
98 group_name = 'sometest' |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
99 gr = ReposGroupModel().create(group_name=group_name, |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
100 group_description='test',) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
101 self.Session().commit() |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
102 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
103 repo_name = 'ingroup' |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
104 repo_name_full = RepoGroup.url_sep().join([group_name, repo_name]) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
105 description = 'description for newly created repo' |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
106 private = False |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
107 response = self.app.post(url('repos'), {'repo_name': repo_name, |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
108 'repo_type': 'hg', |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
109 'clone_uri': '', |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
110 'repo_group': gr.group_id, |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
111 'description': description, |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
112 'private': private, |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
113 'landing_rev': 'tip'}) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
114 self.checkSessionFlash(response, |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
115 'created repository %s' % (repo_name)) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
116 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
117 #test if the repo was created in the database |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
118 new_repo = self.Session().query(Repository)\ |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
119 .filter(Repository.repo_name == repo_name_full).one() |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
120 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
121 self.assertEqual(new_repo.repo_name, repo_name_full) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
122 self.assertEqual(new_repo.description, description) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
123 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
124 #test if repository is visible in the list ? |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
125 response = response.follow() |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
126 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
127 response.mustcontain(repo_name_full) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
128 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
129 #test if repository was created on filesystem |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
130 try: |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
131 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name_full)) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
132 except: |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
133 ReposGroupModel().delete(group_name) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
134 self.Session().commit() |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
135 self.fail('no repo %s in filesystem' % repo_name) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
136 |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
137 RepoModel().delete(repo_name_full) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
138 ReposGroupModel().delete(group_name) |
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
139 self.Session().commit() |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
140 |
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
|
141 def test_create_git(self): |
8acbfa837180
Tests rewrite for 1.2 added some globals configs to make tests easier.
Marcin Kuzminski <marcin@python-works.com>
parents:
628
diff
changeset
|
142 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
|
143 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
|
144 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
|
145 private = False |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
146 response = self.app.post(url('repos'), {'repo_name': repo_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
147 'repo_type': 'git', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
148 'clone_uri': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
149 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
150 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
151 'private': private, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
152 'landing_rev': 'tip'}) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
153 self.checkSessionFlash(response, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
154 '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
|
155 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
156 #test if the repo was created in the database |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
157 new_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
158 .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
|
159 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
160 self.assertEqual(new_repo.repo_name, repo_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
161 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
|
162 |
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 #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
|
164 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
|
165 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
166 response.mustcontain(repo_name) |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
167 |
1037
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
168 #test if repository was created on filesystem |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
169 try: |
b1d6478d4561
added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents:
728
diff
changeset
|
170 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
|
171 except: |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
172 self.fail('no repo %s in filesystem' % repo_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
173 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
174 def test_create_git_non_ascii(self): |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
175 self.log_user() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
176 non_ascii = "ąęł" |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
177 repo_name = "%s%s" % (NEW_GIT_REPO, non_ascii) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
178 repo_name_unicode = repo_name.decode('utf8') |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
179 description = 'description for newly created repo' + non_ascii |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
180 description_unicode = description.decode('utf8') |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
181 private = False |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
182 response = self.app.post(url('repos'), {'repo_name': repo_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
183 'repo_type': 'git', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
184 'clone_uri': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
185 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
186 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
187 'private': private, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
188 'landing_rev': 'tip'}) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
189 self.checkSessionFlash(response, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
190 'created repository %s' % (repo_name_unicode)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
191 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
192 #test if the repo was created in the database |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
193 new_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
194 .filter(Repository.repo_name == repo_name_unicode).one() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
195 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
196 self.assertEqual(new_repo.repo_name, repo_name_unicode) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
197 self.assertEqual(new_repo.description, description_unicode) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
198 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
199 #test if repository is visible in the list ? |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
200 response = response.follow() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
201 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
202 response.mustcontain(repo_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
203 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
204 #test if repository was created on filesystem |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
205 try: |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
206 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
207 except: |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
208 self.fail('no repo %s in filesystem' % repo_name) |
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_new(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
211 self.log_user() |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
212 response = self.app.get(url('new_repo')) |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
213 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
214 def test_new_as_xml(self): |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
215 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
|
216 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
217 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
|
218 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
|
219 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
220 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
|
221 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
|
222 params=dict(_method='put')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
223 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
224 def test_delete_hg(self): |
628 | 225 self.log_user() |
226 repo_name = 'vcs_test_new_to_delete' | |
227 description = 'description for newly created repo' | |
228 private = False | |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
229 response = self.app.post(url('repos'), {'repo_name': repo_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
230 'repo_type': 'hg', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
231 'clone_uri': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
232 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
233 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
234 'private': private, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
235 'landing_rev': 'tip'}) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
236 self.checkSessionFlash(response, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
237 '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
|
238 |
628 | 239 #test if the repo was created in the database |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
240 new_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
241 .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
|
242 |
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
|
243 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
|
244 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
|
245 |
628 | 246 #test if repository is visible in the list ? |
247 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
|
248 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
249 response.mustcontain(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
|
250 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
251 #test if repository was created on filesystem |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
252 try: |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
253 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
254 except: |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
255 self.fail('no repo %s in filesystem' % 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
|
256 |
628 | 257 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
|
258 |
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
|
259 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
|
260 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
|
261 |
628 | 262 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
|
263 |
628 | 264 #check if repo was deleted from db |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
265 deleted_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
266 .filter(Repository.repo_name == repo_name).scalar() |
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
|
267 |
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
|
268 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
|
269 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
270 self.assertEqual(os.path.isdir(os.path.join(TESTS_TMP_PATH, repo_name)), |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
271 False) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
272 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
273 def test_delete_git(self): |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
274 self.log_user() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
275 repo_name = 'vcs_test_new_to_delete' |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
276 description = 'description for newly created repo' |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
277 private = False |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
278 response = self.app.post(url('repos'), {'repo_name': repo_name, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
279 'repo_type': 'git', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
280 'clone_uri': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
281 'repo_group': '', |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
282 'description': description, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
283 'private': private, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
284 'landing_rev': 'tip'}) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
285 self.checkSessionFlash(response, |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
286 'created repository %s' % (repo_name)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
287 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
288 #test if the repo was created in the database |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
289 new_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
290 .filter(Repository.repo_name == repo_name).one() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
291 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
292 self.assertEqual(new_repo.repo_name, repo_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
293 self.assertEqual(new_repo.description, description) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
294 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
295 #test if repository is visible in the list ? |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
296 response = response.follow() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
297 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
298 response.mustcontain(repo_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
299 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
300 #test if repository was created on filesystem |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
301 try: |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
302 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
303 except: |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
304 self.fail('no repo %s in filesystem' % repo_name) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
305 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
306 response = self.app.delete(url('repo', repo_name=repo_name)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
307 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
308 self.assertTrue('''deleted repository %s''' % (repo_name) in |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
309 response.session['flash'][0]) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
310 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
311 response.follow() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
312 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
313 #check if repo was deleted from db |
2529
40b3a54391f9
Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents:
2459
diff
changeset
|
314 deleted_repo = self.Session().query(Repository)\ |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
315 .filter(Repository.repo_name == repo_name).scalar() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
316 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
317 self.assertEqual(deleted_repo, None) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
318 |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
319 self.assertEqual(os.path.isdir(os.path.join(TESTS_TMP_PATH, repo_name)), |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
320 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
|
321 |
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
|
322 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
|
323 #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
|
324 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
|
325 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
326 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
|
327 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
|
328 params=dict(_method='delete')) |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
329 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
330 def test_show_hg(self): |
567
80dc0a23edf7
fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents:
547
diff
changeset
|
331 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
|
332 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
|
333 |
2459
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
334 def test_show_git(self): |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
335 self.log_user() |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
336 response = self.app.get(url('repo', repo_name=GIT_REPO)) |
9492ab68331f
Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents:
2007
diff
changeset
|
337 |
47
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
338 |
f6ac79182600
Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff
changeset
|
339 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
|
340 response = self.app.get(url('edit_repo', repo_name=HG_REPO)) |