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