##// END OF EJS Templates
Imported some of the GPLv3'd changes from RhodeCode v2.2.5....
Imported some of the GPLv3'd changes from RhodeCode v2.2.5. This imports changes between changesets 21af6c4eab3d and 6177597791c2 in RhodeCode's original repository, including only changes to Python files and HTML. RhodeCode clearly licensed its changes to these files under GPLv3 in their /LICENSE file, which states the following: The Python code and integrated HTML are licensed under the GPLv3 license. (See: https://code.rhodecode.com/rhodecode/files/v2.2.5/LICENSE or http://web.archive.org/web/20140512193334/https://code.rhodecode.com/rhodecode/files/f3b123159901f15426d18e3dc395e8369f70ebe0/LICENSE for an online copy of that LICENSE file) Conservancy reviewed these changes and confirmed that they can be licensed as a whole to the Kallithea project under GPLv3-only. While some of the contents committed herein are clearly licensed GPLv3-or-later, on the whole we must assume the are GPLv3-only, since the statement above from RhodeCode indicates that they intend GPLv3-only as their license, per GPLv3ยง14 and other relevant sections of GPLv3.

File last commit:

r3797:d7488551 beta
r4116:ffd45b18 rhodecode-2.2.5-gpl
Show More
test_vcs.py
86 lines | 2.6 KiB | text/x-python | PythonLexer
from __future__ import with_statement
import os
import shutil
from rhodecode.lib.vcs import VCSError, get_repo, get_backend
from rhodecode.lib.vcs.backends.hg import MercurialRepository
from rhodecode.lib.vcs.utils.compat import unittest
from rhodecode.tests.vcs.conf import TEST_HG_REPO, TEST_GIT_REPO, TEST_TMP_PATH
class VCSTest(unittest.TestCase):
"""
Tests for main module's methods.
"""
def test_get_backend(self):
hg = get_backend('hg')
self.assertEqual(hg, MercurialRepository)
def test_alias_detect_hg(self):
alias = 'hg'
path = TEST_HG_REPO
backend = get_backend(alias)
repo = backend(path)
self.assertEqual('hg',repo.alias)
def test_alias_detect_git(self):
alias = 'git'
path = TEST_GIT_REPO
backend = get_backend(alias)
repo = backend(path)
self.assertEqual('git',repo.alias)
def test_wrong_alias(self):
alias = 'wrong_alias'
self.assertRaises(VCSError, get_backend, alias)
def test_get_repo(self):
alias = 'hg'
path = TEST_HG_REPO
backend = get_backend(alias)
repo = backend(path)
self.assertEqual(repo.__class__, get_repo(path, alias).__class__)
self.assertEqual(repo.path, get_repo(path, alias).path)
def test_get_repo_autoalias_hg(self):
alias = 'hg'
path = TEST_HG_REPO
backend = get_backend(alias)
repo = backend(path)
self.assertEqual(repo.__class__, get_repo(path).__class__)
self.assertEqual(repo.path, get_repo(path).path)
def test_get_repo_autoalias_git(self):
alias = 'git'
path = TEST_GIT_REPO
backend = get_backend(alias)
repo = backend(path)
self.assertEqual(repo.__class__, get_repo(path).__class__)
self.assertEqual(repo.path, get_repo(path).path)
def test_get_repo_err(self):
blank_repo_path = os.path.join(TEST_TMP_PATH, 'blank-error-repo')
if os.path.isdir(blank_repo_path):
shutil.rmtree(blank_repo_path)
os.mkdir(blank_repo_path)
self.assertRaises(VCSError, get_repo, blank_repo_path)
self.assertRaises(VCSError, get_repo, blank_repo_path + 'non_existing')
def test_get_repo_multialias(self):
multialias_repo_path = os.path.join(TEST_TMP_PATH, 'hg-git-repo')
if os.path.isdir(multialias_repo_path):
shutil.rmtree(multialias_repo_path)
os.mkdir(multialias_repo_path)
os.mkdir(os.path.join(multialias_repo_path, '.git'))
os.mkdir(os.path.join(multialias_repo_path, '.hg'))
self.assertRaises(VCSError, get_repo, multialias_repo_path)