##// END OF EJS Templates
tests: Fix a helper method that checks if a repository is available on filesystem....
Martin Bornhold -
r486:e773cd0c default
parent child Browse files
Show More
@@ -18,14 +18,12 b''
18 18 # RhodeCode Enterprise Edition, including its added features, Support services,
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 import os
22 21 import urllib
23 22
24 23 import mock
25 24 import pytest
26 25
27 26 from rhodecode.lib import auth
28 from rhodecode.lib import vcs
29 27 from rhodecode.lib.utils2 import safe_str, str2bool
30 28 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
31 29 from rhodecode.model.db import Repository, RepoGroup, UserRepoToPerm, User,\
@@ -38,9 +36,9 b' from rhodecode.model.user import UserMod'
38 36 from rhodecode.tests import (
39 37 login_user_session, url, assert_session_flash, TEST_USER_ADMIN_LOGIN,
40 38 TEST_USER_REGULAR_LOGIN, TEST_USER_REGULAR_PASS, HG_REPO, GIT_REPO,
41 TESTS_TMP_PATH, logout_user_session)
39 logout_user_session)
42 40 from rhodecode.tests.fixture import Fixture, error_function
43 from rhodecode.tests.utils import AssertResponse
41 from rhodecode.tests.utils import AssertResponse, repo_on_filesystem
44 42
45 43 fixture = Fixture()
46 44
@@ -1243,14 +1241,6 b' class TestVcsSettings(object):'
1243 1241 assert repo_element.value == global_element.value
1244 1242
1245 1243
1246 def repo_on_filesystem(repo_name):
1247 try:
1248 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name))
1249 return True
1250 except Exception:
1251 return False
1252
1253
1254 1244 def _get_permission_for_user(user, repo):
1255 1245 perm = UserRepoToPerm.query()\
1256 1246 .filter(UserRepoToPerm.repository ==
@@ -19,13 +19,11 b''
19 19 # and proprietary license terms, please see https://rhodecode.com/licenses/
20 20
21 21 import re
22 import os
23 22
24 23 import mock
25 24 import pytest
26 25
27 26 from rhodecode.controllers import summary
28 from rhodecode.lib import vcs
29 27 from rhodecode.lib import helpers as h
30 28 from rhodecode.lib.compat import OrderedDict
31 29 from rhodecode.lib.vcs.exceptions import RepositoryRequirementError
@@ -34,9 +32,9 b' from rhodecode.model.meta import Session'
34 32 from rhodecode.model.repo import RepoModel
35 33 from rhodecode.model.scm import ScmModel
36 34 from rhodecode.tests import (
37 TestController, url, HG_REPO, assert_session_flash, TESTS_TMP_PATH)
35 TestController, url, HG_REPO, assert_session_flash)
38 36 from rhodecode.tests.fixture import Fixture
39 from rhodecode.tests.utils import AssertResponse
37 from rhodecode.tests.utils import AssertResponse, repo_on_filesystem
40 38
41 39
42 40 fixture = Fixture()
@@ -400,14 +398,6 b' class TestRepoLocation:'
400 398 response, 'The repository at %s cannot be located.' % repo_name)
401 399
402 400
403 def repo_on_filesystem(repo_name):
404 try:
405 vcs.get_repo(os.path.join(TESTS_TMP_PATH, repo_name))
406 return True
407 except Exception:
408 return False
409
410
411 401 class TestCreateFilesUrl(object):
412 402 def test_creates_non_svn_url(self):
413 403 controller = summary.SummaryController()
@@ -283,3 +283,11 b' def get_session_from_response(response):'
283 283 """
284 284 # TODO: Try to look up the session key also.
285 285 return response.request.environ['beaker.session']
286
287
288 def repo_on_filesystem(repo_name):
289 from rhodecode.lib import vcs
290 from rhodecode.tests import TESTS_TMP_PATH
291 repo = vcs.get_vcs_instance(
292 os.path.join(TESTS_TMP_PATH, repo_name), create=False)
293 return repo is not None
General Comments 0
You need to be logged in to leave comments. Login now