Show More
@@ -196,7 +196,7 b' class BaseTestController(object):' | |||
|
196 | 196 | 'password': password}) |
|
197 | 197 | |
|
198 | 198 | if 'Invalid username or password' in response.body: |
|
199 |
|
|
|
199 | pytest.fail('could not login using %s %s' % (username, password)) | |
|
200 | 200 | |
|
201 | 201 | self.assertEqual(response.status, '302 Found') |
|
202 | 202 | self.assert_authenticated_user(response, username) |
@@ -219,14 +219,14 b' class BaseTestController(object):' | |||
|
219 | 219 | |
|
220 | 220 | def checkSessionFlash(self, response, msg=None, skip=0, _matcher=lambda msg, m: msg in m): |
|
221 | 221 | if 'flash' not in response.session: |
|
222 |
|
|
|
222 | pytest.fail(safe_str(u'msg `%s` not found - session has no flash:\n%s' % (msg, response))) | |
|
223 | 223 | try: |
|
224 | 224 | level, m = response.session['flash'][-1 - skip] |
|
225 | 225 | if _matcher(msg, m): |
|
226 | 226 | return |
|
227 | 227 | except IndexError: |
|
228 | 228 | pass |
|
229 |
|
|
|
229 | pytest.fail(safe_str(u'msg `%s` not found in session flash (skipping %s): %s' % | |
|
230 | 230 | (msg, skip, |
|
231 | 231 | ', '.join('`%s`' % m for level, m in response.session['flash'])))) |
|
232 | 232 |
@@ -82,7 +82,7 b' class _BaseTest(object):' | |||
|
82 | 82 | try: |
|
83 | 83 | vcs.get_repo(safe_str(os.path.join(TESTS_TMP_PATH, repo_name))) |
|
84 | 84 | except vcs.exceptions.VCSError: |
|
85 |
|
|
|
85 | pytest.fail('no repo %s in filesystem' % repo_name) | |
|
86 | 86 | |
|
87 | 87 | RepoModel().delete(repo_name) |
|
88 | 88 | Session().commit() |
@@ -136,7 +136,7 b' class _BaseTest(object):' | |||
|
136 | 136 | except vcs.exceptions.VCSError: |
|
137 | 137 | RepoGroupModel().delete(group_name) |
|
138 | 138 | Session().commit() |
|
139 |
|
|
|
139 | pytest.fail('no repo %s in filesystem' % repo_name) | |
|
140 | 140 | |
|
141 | 141 | RepoModel().delete(repo_name_full) |
|
142 | 142 | RepoGroupModel().delete(group_name) |
@@ -228,7 +228,7 b' class _BaseTest(object):' | |||
|
228 | 228 | except vcs.exceptions.VCSError: |
|
229 | 229 | RepoGroupModel().delete(group_name) |
|
230 | 230 | Session().commit() |
|
231 |
|
|
|
231 | pytest.fail('no repo %s in filesystem' % repo_name) | |
|
232 | 232 | |
|
233 | 233 | RepoModel().delete(repo_name_full) |
|
234 | 234 | RepoGroupModel().delete(group_name) |
@@ -285,7 +285,7 b' class _BaseTest(object):' | |||
|
285 | 285 | except vcs.exceptions.VCSError: |
|
286 | 286 | RepoGroupModel().delete(group_name) |
|
287 | 287 | Session().commit() |
|
288 |
|
|
|
288 | pytest.fail('no repo %s in filesystem' % repo_name) | |
|
289 | 289 | |
|
290 | 290 | #check if inherited permissiona are applied |
|
291 | 291 | inherited_perms = UserRepoToPerm.query() \ |
@@ -360,7 +360,7 b' class _BaseTest(object):' | |||
|
360 | 360 | try: |
|
361 | 361 | vcs.get_repo(safe_str(os.path.join(TESTS_TMP_PATH, repo_name))) |
|
362 | 362 | except vcs.exceptions.VCSError: |
|
363 |
|
|
|
363 | pytest.fail('no repo %s in filesystem' % repo_name) | |
|
364 | 364 | |
|
365 | 365 | response = self.app.post(url('delete_repo', repo_name=repo_name), |
|
366 | 366 | params={'_method': 'delete', '_authentication_token': self.authentication_token()}) |
@@ -413,7 +413,7 b' class _BaseTest(object):' | |||
|
413 | 413 | try: |
|
414 | 414 | vcs.get_repo(safe_str(os.path.join(TESTS_TMP_PATH, repo_name))) |
|
415 | 415 | except vcs.exceptions.VCSError: |
|
416 |
|
|
|
416 | pytest.fail('no repo %s in filesystem' % repo_name) | |
|
417 | 417 | |
|
418 | 418 | response = self.app.post(url('delete_repo', repo_name=repo_name), |
|
419 | 419 | params={'_method': 'delete', '_authentication_token': self.authentication_token()}) |
@@ -4,6 +4,9 b' import sys' | |||
|
4 | 4 | import mock |
|
5 | 5 | import datetime |
|
6 | 6 | import urllib2 |
|
7 | ||
|
8 | import pytest | |
|
9 | ||
|
7 | 10 | from kallithea.lib.vcs.backends.git import GitRepository, GitChangeset |
|
8 | 11 | from kallithea.lib.vcs.exceptions import RepositoryError, VCSError, NodeDoesNotExistError |
|
9 | 12 | from kallithea.lib.vcs.nodes import NodeKind, FileNode, DirNode, NodeState |
@@ -17,7 +20,7 b' class GitRepositoryTest(unittest.TestCas' | |||
|
17 | 20 | |
|
18 | 21 | def __check_for_existing_repo(self): |
|
19 | 22 | if os.path.exists(TEST_GIT_REPO_CLONE): |
|
20 |
|
|
|
23 | pytest.fail('Cannot test git clone repo as location %s already ' | |
|
21 | 24 | 'exists. You should manually remove it first.' |
|
22 | 25 | % TEST_GIT_REPO_CLONE) |
|
23 | 26 | |
@@ -339,7 +342,7 b' class GitChangesetTest(unittest.TestCase' | |||
|
339 | 342 | idx += 1 |
|
340 | 343 | rev_id = self.repo.revisions[rev] |
|
341 | 344 | if idx > limit: |
|
342 |
|
|
|
345 | pytest.fail("Exceeded limit already (getting revision %s, " | |
|
343 | 346 | "there are %s total revisions, offset=%s, limit=%s)" |
|
344 | 347 | % (rev_id, count, offset, limit)) |
|
345 | 348 | self.assertEqual(changeset, self.repo.get_changeset(rev_id)) |
@@ -347,7 +350,7 b' class GitChangesetTest(unittest.TestCase' | |||
|
347 | 350 | start = offset |
|
348 | 351 | end = limit and offset + limit or None |
|
349 | 352 | sliced = list(self.repo[start:end]) |
|
350 |
|
|
|
353 | pytest.failUnlessEqual(result, sliced, | |
|
351 | 354 | msg="Comparison failed for limit=%s, offset=%s" |
|
352 | 355 | "(get_changeset returned: %s and sliced: %s" |
|
353 | 356 | % (limit, offset, result, sliced)) |
@@ -1,5 +1,8 b'' | |||
|
1 | 1 | |
|
2 | 2 | import os |
|
3 | ||
|
4 | import pytest | |
|
5 | ||
|
3 | 6 | from kallithea.lib.utils2 import safe_str |
|
4 | 7 | from kallithea.lib.vcs.backends.hg import MercurialRepository, MercurialChangeset |
|
5 | 8 | from kallithea.lib.vcs.exceptions import RepositoryError, VCSError, NodeDoesNotExistError |
@@ -20,7 +23,7 b' class MercurialRepositoryTest(unittest.T' | |||
|
20 | 23 | |
|
21 | 24 | def __check_for_existing_repo(self): |
|
22 | 25 | if os.path.exists(TEST_HG_REPO_CLONE): |
|
23 |
|
|
|
26 | pytest.fail('Cannot test mercurial clone repo as location %s already ' | |
|
24 | 27 | 'exists. You should manually remove it first.' |
|
25 | 28 | % TEST_HG_REPO_CLONE) |
|
26 | 29 | |
@@ -67,7 +70,7 b' class MercurialRepositoryTest(unittest.T' | |||
|
67 | 70 | |
|
68 | 71 | def test_pull(self): |
|
69 | 72 | if os.path.exists(TEST_HG_REPO_PULL): |
|
70 |
|
|
|
73 | pytest.fail('Cannot test mercurial pull command as location %s ' | |
|
71 | 74 | 'already exists. You should manually remove it first' |
|
72 | 75 | % TEST_HG_REPO_PULL) |
|
73 | 76 | repo_new = MercurialRepository(TEST_HG_REPO_PULL, create=True) |
@@ -76,7 +76,7 b' class NodeBasicTest(unittest.TestCase):' | |||
|
76 | 76 | ''' |
|
77 | 77 | def _test_trailing_slash(self, path): |
|
78 | 78 | if not path.endswith('/'): |
|
79 |
|
|
|
79 | pytest.fail("Trailing slash tests needs paths to end with slash") | |
|
80 | 80 | for kind in NodeKind.FILE, NodeKind.DIR: |
|
81 | 81 | self.assertRaises(NodeError, Node, path=path, kind=kind) |
|
82 | 82 |
General Comments 0
You need to be logged in to leave comments.
Login now