##// END OF EJS Templates
fixes for tests on Windows
marcink -
r2255:95800dad beta
parent child Browse files
Show More
@@ -48,6 +48,7 b' from rhodecode.lib.vcs.nodes import File'
48
48
49 from rhodecode.model.repo import RepoModel
49 from rhodecode.model.repo import RepoModel
50 from rhodecode.model.scm import ScmModel
50 from rhodecode.model.scm import ScmModel
51 from rhodecode.model.db import Repository
51
52
52 from rhodecode.controllers.changeset import anchor_url, _ignorews_url,\
53 from rhodecode.controllers.changeset import anchor_url, _ignorews_url,\
53 _context_url, get_line_ctx, get_ignore_ws
54 _context_url, get_line_ctx, get_ignore_ws
@@ -168,7 +169,7 b' class FilesController(BaseRepoController'
168 file_node = self.__get_filenode_or_redirect(repo_name, cs, f_path)
169 file_node = self.__get_filenode_or_redirect(repo_name, cs, f_path)
169
170
170 response.content_disposition = 'attachment; filename=%s' % \
171 response.content_disposition = 'attachment; filename=%s' % \
171 safe_str(f_path.split(os.sep)[-1])
172 safe_str(f_path.split(Repository.url_sep())[-1])
172
173
173 response.content_type = file_node.mimetype
174 response.content_type = file_node.mimetype
174 return file_node.content
175 return file_node.content
@@ -197,11 +197,13 b' class TestFilesController(TestController'
197 repo_name=HG_REPO,
197 repo_name=HG_REPO,
198 fname=fname))
198 fname=fname))
199
199
200 assert response.status == '200 OK', 'wrong response code'
200 self.assertEqual(response.status, '200 OK')
201 assert response.response._headers.items() == [('Pragma', 'no-cache'),
201 self.assertEqual(response.response._headers.items(),
202 ('Cache-Control', 'no-cache'),
202 [('Pragma', 'no-cache'),
203 ('Content-Type', '%s; charset=utf-8' % info[0]),
203 ('Cache-Control', 'no-cache'),
204 ('Content-Disposition', 'attachment; filename=%s' % filename), ], 'wrong headers'
204 ('Content-Type', '%s; charset=utf-8' % info[0]),
205 ('Content-Disposition', 'attachment; filename=%s' % filename),]
206 )
205
207
206 def test_archival_wrong_ext(self):
208 def test_archival_wrong_ext(self):
207 self.log_user()
209 self.log_user()
@@ -212,8 +214,7 b' class TestFilesController(TestController'
212 response = self.app.get(url(controller='files', action='archivefile',
214 response = self.app.get(url(controller='files', action='archivefile',
213 repo_name=HG_REPO,
215 repo_name=HG_REPO,
214 fname=fname))
216 fname=fname))
215 assert 'Unknown archive type' in response.body
217 response.mustcontain('Unknown archive type')
216
217
218
218 def test_archival_wrong_revision(self):
219 def test_archival_wrong_revision(self):
219 self.log_user()
220 self.log_user()
@@ -224,7 +225,7 b' class TestFilesController(TestController'
224 response = self.app.get(url(controller='files', action='archivefile',
225 response = self.app.get(url(controller='files', action='archivefile',
225 repo_name=HG_REPO,
226 repo_name=HG_REPO,
226 fname=fname))
227 fname=fname))
227 assert 'Unknown revision' in response.body
228 response.mustcontain('Unknown revision')
228
229
229 #==========================================================================
230 #==========================================================================
230 # RAW FILE
231 # RAW FILE
@@ -236,8 +237,8 b' class TestFilesController(TestController'
236 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
237 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
237 f_path='vcs/nodes.py'))
238 f_path='vcs/nodes.py'))
238
239
239 assert response.content_disposition == "attachment; filename=nodes.py"
240 self.assertEqual(response.content_disposition, "attachment; filename=nodes.py")
240 assert response.content_type == "text/x-python"
241 self.assertEqual(response.content_type, "text/x-python")
241
242
242 def test_raw_file_wrong_cs(self):
243 def test_raw_file_wrong_cs(self):
243 self.log_user()
244 self.log_user()
@@ -277,7 +278,7 b' class TestFilesController(TestController'
277 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
278 revision='27cd5cce30c96924232dffcd24178a07ffeb5dfc',
278 f_path='vcs/nodes.py'))
279 f_path='vcs/nodes.py'))
279
280
280 assert response.content_type == "text/plain"
281 self.assertEqual(response.content_type, "text/plain")
281
282
282 def test_raw_wrong_cs(self):
283 def test_raw_wrong_cs(self):
283 self.log_user()
284 self.log_user()
@@ -5,7 +5,8 b' from rhodecode.tests import *'
5 from rhodecode.model.repos_group import ReposGroupModel
5 from rhodecode.model.repos_group import ReposGroupModel
6 from rhodecode.model.repo import RepoModel
6 from rhodecode.model.repo import RepoModel
7 from rhodecode.model.db import RepoGroup, User, Notification, UserNotification, \
7 from rhodecode.model.db import RepoGroup, User, Notification, UserNotification, \
8 UsersGroup, UsersGroupMember, Permission, UsersGroupRepoGroupToPerm
8 UsersGroup, UsersGroupMember, Permission, UsersGroupRepoGroupToPerm,\
9 Repository
9 from sqlalchemy.exc import IntegrityError
10 from sqlalchemy.exc import IntegrityError
10 from rhodecode.model.user import UserModel
11 from rhodecode.model.user import UserModel
11
12
@@ -153,24 +154,23 b' class TestReposGroups(unittest.TestCase)'
153 self.assertTrue(self.__check_path('g2', 'g1'))
154 self.assertTrue(self.__check_path('g2', 'g1'))
154
155
155 # test repo
156 # test repo
156 self.assertEqual(r.repo_name, os.path.join('g2', 'g1', r.just_name))
157 self.assertEqual(r.repo_name, RepoGroup.url_sep().join(['g2', 'g1', r.just_name]))
157
158
158
159 def test_move_to_root(self):
159 def test_move_to_root(self):
160 g1 = _make_group('t11')
160 g1 = _make_group('t11')
161 Session.commit()
161 Session.commit()
162 g2 = _make_group('t22',parent_id=g1.group_id)
162 g2 = _make_group('t22', parent_id=g1.group_id)
163 Session.commit()
163 Session.commit()
164
164
165 self.assertEqual(g2.full_path,'t11/t22')
165 self.assertEqual(g2.full_path, 't11/t22')
166 self.assertTrue(self.__check_path('t11', 't22'))
166 self.assertTrue(self.__check_path('t11', 't22'))
167
167
168 g2 = self.__update_group(g2.group_id, 'g22', parent_id=None)
168 g2 = self.__update_group(g2.group_id, 'g22', parent_id=None)
169 Session.commit()
169 Session.commit()
170
170
171 self.assertEqual(g2.group_name,'g22')
171 self.assertEqual(g2.group_name, 'g22')
172 # we moved out group from t1 to '' so it's full path should be 'g2'
172 # we moved out group from t1 to '' so it's full path should be 'g2'
173 self.assertEqual(g2.full_path,'g22')
173 self.assertEqual(g2.full_path, 'g22')
174 self.assertFalse(self.__check_path('t11', 't22'))
174 self.assertFalse(self.__check_path('t11', 't22'))
175 self.assertTrue(self.__check_path('g22'))
175 self.assertTrue(self.__check_path('g22'))
176
176
@@ -620,7 +620,7 b' class TestPermissions(unittest.TestCase)'
620 # add repo to group
620 # add repo to group
621 form_data = {
621 form_data = {
622 'repo_name':HG_REPO,
622 'repo_name':HG_REPO,
623 'repo_name_full':os.path.join(self.g1.group_name,HG_REPO),
623 'repo_name_full':RepoGroup.url_sep().join([self.g1.group_name,HG_REPO]),
624 'repo_type':'hg',
624 'repo_type':'hg',
625 'clone_uri':'',
625 'clone_uri':'',
626 'repo_group':self.g1.group_id,
626 'repo_group':self.g1.group_id,
General Comments 0
You need to be logged in to leave comments. Login now