author David Douard <david.douard@logilab.fr>
Sun, 26 Oct 2014 18:30:36 +0100
changeset 1736 72ec6c7e956c
parent 1677 998cd9f5cbed
child 1686 79a43a0c8249
permissions -rw-r--r--
[apycotlib] port to narval 4.2 The connection handler is now a CWProxy (cwclientlib), and there is no CreateSubEntity view any more since we can now create File entity using cwclientlib and rqlcontroller.

"""unit tests for apycot.repositories"""

import os
from copy import copy

from logilab.common import testlib

import cubicweb.devtools
from cubes.apycot.testutils import MockVCSFile as VCSFile

from apycotlib.repositories import *

def setUpModule():
    os.environ['APYCOT_ROOT'] = ''

def tearDownModule():
    del os.environ['APYCOT_ROOT']

class GetRepositoryTC(testlib.TestCase):
    def test(self):
        vcsfile = VCSFile('mercurial', source_url='http://www.labas.org')
        repo = get_repository({'repository': vcsfile, 'path': 'toto'})
        self.assert_(isinstance(repo, HGRepository))

class HGRepositoryTC(testlib.TestCase):
    def test_co_path(self):
        vcsfile = VCSFile('mercurial', source_url=u'file://' + os.path.join(self.datadir, 'badsyntax'))
        repo = HGRepository({'repository': vcsfile, 'path': 'common'})
        self.assertEqual(repo.co_path, 'badsyntax/common')
        repo = HGRepository({'repository': vcsfile, 'path': 'common/sub'})
        self.assertEqual(repo.co_path, 'badsyntax/common/sub')

if __name__ == '__main__':