annotate rhodecode/tests/functional/test_admin_repos.py @ 3415:b8f929bff7e3 beta

fixed tests and missing replacements from 5f1850e4712a
author Marcin Kuzminski <marcin@python-works.com>
date Wed, 27 Feb 2013 02:27:09 +0100
parents b4daef4cc26d
children 7abbb77b02d0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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'
3057
79c5967a1e5c whitespace and formatting
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
29 response = self.app.post(url('repos'),
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
30 _get_repo_create_params(repo_private=False,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
31 repo_name=repo_name,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
32 repo_description=description))
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
33 self.checkSessionFlash(response,
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
34 '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
35
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
36 #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
37 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
38 .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
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 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
41 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
42
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
43 #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
44 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
45
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
46 response.mustcontain(repo_name)
1037
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
47
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
48 #test if repository was created on filesystem
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
49 try:
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
50 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
51 except:
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
52 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
53
1398
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
54 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
55 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
56 non_ascii = "ąęł"
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
57 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
58 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
59 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
60 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
61 private = False
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
62 response = self.app.post(url('repos'),
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
63 _get_repo_create_params(repo_private=False,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
64 repo_name=repo_name,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
65 repo_description=description))
1398
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
66 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
67 '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
68
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
69 #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
70 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
71 .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
72
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
73 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
74 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
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 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
77 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
78
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
79 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
80
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
81 #test if repository 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
82 try:
6dee43453f58 added test for non ascii repositories and fixed users_groups test
Marcin Kuzminski <marcin@python-works.com>
parents: 1366
diff changeset
83 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
84 except:
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
85 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
86
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
87 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
88 self.log_user()
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
89
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
90 ## create GROUP
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
91 group_name = 'sometest'
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
92 gr = ReposGroupModel().create(group_name=group_name,
3222
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3219
diff changeset
93 group_description='test',
b4daef4cc26d Group management delegation:
Marcin Kuzminski <marcin@python-works.com>
parents: 3219
diff changeset
94 owner=TEST_USER_ADMIN_LOGIN)
2529
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
95 self.Session().commit()
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 repo_name = 'ingroup'
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
98 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
99 description = 'description for newly created repo'
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
100 response = self.app.post(url('repos'),
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
101 _get_repo_create_params(repo_private=False,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
102 repo_name=repo_name,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
103 repo_description=description,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
104 repo_group=gr.group_id,))
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
105
2529
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
106 self.checkSessionFlash(response,
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
107 'created repository %s' % (repo_name))
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
108
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
109 #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
110 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
111 .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
112
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
113 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
114 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
115
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
116 #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
117 response = response.follow()
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
118
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
119 response.mustcontain(repo_name_full)
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 #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
122 try:
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
123 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
124 except:
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
125 ReposGroupModel().delete(group_name)
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
126 self.Session().commit()
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
127 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
128
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
129 RepoModel().delete(repo_name_full)
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
130 ReposGroupModel().delete(group_name)
40b3a54391f9 Added functional test create repo with a group
Marcin Kuzminski <marcin@python-works.com>
parents: 2459
diff changeset
131 self.Session().commit()
1037
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
132
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
133 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
134 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
135 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
136 description = 'description for newly created repo'
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
137
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
138 response = self.app.post(url('repos'),
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
139 _get_repo_create_params(repo_private=False,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
140 repo_type='git',
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
141 repo_name=repo_name,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
142 repo_description=description))
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
143 self.checkSessionFlash(response,
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
144 '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
145
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
146 #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
147 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
148 .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
149
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
150 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
151 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
152
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 #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
154 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
155
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
156 response.mustcontain(repo_name)
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
157
1037
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
158 #test if repository was created on filesystem
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
159 try:
b1d6478d4561 added repo creation filesystem test
Marcin Kuzminski <marcin@python-works.com>
parents: 728
diff changeset
160 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
161 except:
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
162 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
163
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
164 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
165 self.log_user()
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
166 non_ascii = "ąęł"
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
167 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
168 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
169 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
170 description_unicode = description.decode('utf8')
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
171 private = False
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
172 response = self.app.post(url('repos'),
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
173 _get_repo_create_params(repo_private=False,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
174 repo_type='git',
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
175 repo_name=repo_name,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
176 repo_description=description))
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
177
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
178 self.checkSessionFlash(response,
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
179 'created repository %s' % (repo_name_unicode))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
180
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
181 #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
182 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
183 .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
184
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
185 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
186 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
187
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
188 #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
189 response = response.follow()
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
190
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
191 response.mustcontain(repo_name)
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
192
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
193 #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
194 try:
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
195 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
196 except:
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
197 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
198
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
199 def test_new(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
200 self.log_user()
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
201 response = self.app.get(url('new_repo'))
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
202
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
203 def test_new_as_xml(self):
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
204 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
205
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
206 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
207 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
208
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
209 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
210 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
211 params=dict(_method='put'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
212
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
213 def test_delete_hg(self):
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
214 self.log_user()
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
215 repo_name = 'vcs_test_new_to_delete'
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
216 description = 'description for newly created repo'
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
217 response = self.app.post(url('repos'),
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
218 _get_repo_create_params(repo_private=False,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
219 repo_type='hg',
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
220 repo_name=repo_name,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
221 repo_description=description))
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
222
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
223 self.checkSessionFlash(response,
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
224 '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
225
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
226 #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
227 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
228 .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
229
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
230 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
231 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
232
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
233 #test if repository is visible in the list ?
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
234 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
235
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
236 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
237
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
238 #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
239 try:
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
240 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
241 except:
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
242 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
243
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
244 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
245
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
246 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
247 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
248
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
249 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
250
628
dd06bdf974c8 fixed tests,
Marcin Kuzminski <marcin@python-works.com>
parents: 567
diff changeset
251 #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
252 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
253 .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
254
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
255 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
256
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
257 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
258 False)
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
259
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
260 def test_delete_git(self):
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
261 self.log_user()
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
262 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
263 description = 'description for newly created repo'
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
264 private = False
3057
79c5967a1e5c whitespace and formatting
Marcin Kuzminski <marcin@python-works.com>
parents: 3056
diff changeset
265 response = self.app.post(url('repos'),
3056
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
266 _get_repo_create_params(repo_private=False,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
267 repo_type='git',
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
268 repo_name=repo_name,
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
269 repo_description=description))
6104dfd35b16 Implemented #379 defaults settings page for creation of repositories
Marcin Kuzminski <marcin@python-works.com>
parents: 2529
diff changeset
270
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
271 self.checkSessionFlash(response,
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
272 'created repository %s' % (repo_name))
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
273
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
274 #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
275 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
276 .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
277
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
278 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
279 self.assertEqual(new_repo.description, description)
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
280
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
281 #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
282 response = response.follow()
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
283
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
284 response.mustcontain(repo_name)
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
285
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
286 #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
287 try:
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
288 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
289 except:
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
290 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
291
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
292 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
293
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
294 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
295 response.session['flash'][0])
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
296
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
297 response.follow()
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
298
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
299 #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
300 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
301 .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
302
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
303 self.assertEqual(deleted_repo, None)
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
304
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
305 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
306 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
307
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
308 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
309 #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
310 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
311
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
312 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
313 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
314 params=dict(_method='delete'))
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
315
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
316 def test_show_hg(self):
567
80dc0a23edf7 fixed whoosh failure on new repository
Marcin Kuzminski <marcin@python-works.com>
parents: 547
diff changeset
317 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
318 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
319
2459
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
320 def test_show_git(self):
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
321 self.log_user()
9492ab68331f Initial version of landing revisions ref #483
Marcin Kuzminski <marcin@python-works.com>
parents: 2007
diff changeset
322 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
323
47
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
324
f6ac79182600 Added rest controllers for repos and users,
Marcin Kuzminski <marcin@python-blog.com>
parents:
diff changeset
325 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
326 response = self.app.get(url('edit_repo', repo_name=HG_REPO))