# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, bzr from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from snakeoil.test import TestCase bogus = make_bogus_syncer(bzr.bzr_syncer) valid = make_valid_syncer(bzr.bzr_syncer) class TestBzrSyncer(TestCase): def test_uri_parse(self): self.assertEqual(bzr.bzr_syncer.parse_uri("bzr+http://dar"), "http://dar") self.assertRaises(base.uri_exception, bzr.bzr_syncer.parse_uri, "bzr://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "bzr+http://foon.com/dar") o = valid("/tmp/foon", "bzr+http://dar") self.assertEqual(o.uri, "http://dar")
# -*- coding: utf-8 -*- # Copyright: 2015 Michał Górny <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, git_svn from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer bogus = make_bogus_syncer(git_svn.git_svn_syncer) valid = make_valid_syncer(git_svn.git_svn_syncer) class TestGitSVNSyncer(TestCase): def test_uri_parse(self): self.assertEqual( git_svn.git_svn_syncer.parse_uri("git+svn+http://dar"), "http://dar") self.assertRaises(base.uri_exception, git_svn.git_svn_syncer.parse_uri, "git+svn+://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "git+svn+http://foon.com/dar") o = valid("/tmp/foon", "git+svn+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, hg from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer bogus = make_bogus_syncer(hg.hg_syncer) valid = make_valid_syncer(hg.hg_syncer) class TestHgSyncer(TestCase): def test_uri_parse(self): self.assertEqual(hg.hg_syncer.parse_uri("hg+http://dar"), "http://dar") self.assertEqual(hg.hg_syncer.parse_uri("mercurial+http://dar"), "http://dar") self.assertRaises(base.uri_exception, hg.hg_syncer.parse_uri, "hg://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "hg+http://foon.com/dar") o = valid("/tmp/foon", "hg+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from pkgcore.sync import base, svn bogus = make_bogus_syncer(svn.svn_syncer) valid = make_valid_syncer(svn.svn_syncer) class TestsvnParsing(TestCase): def test_parse(self): self.assertRaises(base.uri_exception, svn.svn_syncer.parse_uri, "svn+://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "svn+http://foon.com/dar") o = valid("/tmp/foon", "svn+http://dar") self.assertEqual(o.uri, "svn+http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, rsync from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from snakeoil.test import TestCase bogus = make_bogus_syncer(rsync.rsync_syncer) valid = make_valid_syncer(rsync.rsync_syncer) class TestRsyncSyncer(TestCase): def test_uri_parse(self): self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "rsync+hopefully_nonexistent_binary://foon.com/dar") o = valid("/tmp/foon", "rsync://dar/module") self.assertEqual(o.rsh, None) self.assertEqual(o.uri, "rsync://dar/module/") o = valid("/tmp/foon", "rsync+/bin/sh://dar/module") self.assertEqual(o.uri, "rsync://dar/module/") self.assertEqual(o.rsh, "/bin/sh")
# -*- coding: utf-8 -*- # Copyright: 2015 Michał Górny <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, git_svn from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer bogus = make_bogus_syncer(git_svn.git_svn_syncer) valid = make_valid_syncer(git_svn.git_svn_syncer) class TestGitSVNSyncer(TestCase): def test_uri_parse(self): self.assertEqual( git_svn.git_svn_syncer.parse_uri("git+svn+http://dar"), "http://dar") self.assertRaises( base.uri_exception, git_svn.git_svn_syncer.parse_uri, "git+svn+://dar") self.assertRaises( base.syncer_exception, bogus, "/tmp/foon", "git+svn+http://foon.com/dar") o = valid("/tmp/foon", "git+svn+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, git from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from snakeoil.test import TestCase bogus = make_bogus_syncer(git.git_syncer) valid = make_valid_syncer(git.git_syncer) class TestGitSyncer(TestCase): def test_uri_parse(self): self.assertEqual(git.git_syncer.parse_uri("git+http://dar"), "http://dar") self.assertRaises(base.uri_exception, git.git_syncer.parse_uri, "git+://dar") self.assertRaises(base.uri_exception, git.git_syncer.parse_uri, "https://foo.com/repo.git") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "git+http://foon.com/dar") o = valid("/tmp/foon", "git+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, darcs from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from snakeoil.test import TestCase bogus = make_bogus_syncer(darcs.darcs_syncer) valid = make_valid_syncer(darcs.darcs_syncer) class TestDarcsSyncer(TestCase): def test_uri_parse(self): self.assertEqual(darcs.darcs_syncer.parse_uri("darcs+http://dar"), "http://dar") self.assertRaises(base.uri_exception, darcs.darcs_syncer.parse_uri, "darcs://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "darcs+http://foon.com/dar") o = valid("/tmp/foon", "darcs+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, bzr from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer bogus = make_bogus_syncer(bzr.bzr_syncer) valid = make_valid_syncer(bzr.bzr_syncer) class TestBzrSyncer(TestCase): def test_uri_parse(self): self.assertEqual(bzr.bzr_syncer.parse_uri("bzr+http://dar"), "http://dar") self.assertRaises(base.uri_exception, bzr.bzr_syncer.parse_uri, "bzr://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "bzr+http://foon.com/dar") o = valid("/tmp/foon", "bzr+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, git from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer bogus = make_bogus_syncer(git.git_syncer) valid = make_valid_syncer(git.git_syncer) class TestGitSyncer(TestCase): def test_uri_parse(self): self.assertEqual(git.git_syncer.parse_uri("git+http://dar"), "http://dar") self.assertRaises(base.uri_exception, git.git_syncer.parse_uri, "git+://dar") self.assertRaises(base.uri_exception, git.git_syncer.parse_uri, "https://foo.com/repo.git") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "git+http://foon.com/dar") o = valid("/tmp/foon", "git+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD import os import pwd from pkgcore.sync import base, svn from pkgcore.test import TestCase, SkipTest from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer valid = make_valid_syncer(base.ExternalSyncer) bogus = make_bogus_syncer(base.ExternalSyncer) existing_user = pwd.getpwall()[0].pw_name existing_uid = pwd.getpwnam(existing_user).pw_uid class TestBase(TestCase): def test_init(self): self.assertRaises( base.syncer_exception, bogus, "/tmp/foon", "http://dar") o = valid("/tmp/foon", "http://dar") self.assertEqual(o.local_user, os.getuid()) self.assertEqual(o.uri, "http://dar") o = valid("/tmp/foon", "http://%s::@site" % existing_user) self.assertEqual(o.local_user, existing_uid) self.assertEqual(o.uri, "http://site")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, darcs from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer bogus = make_bogus_syncer(darcs.darcs_syncer) valid = make_valid_syncer(darcs.darcs_syncer) class TestDarcsSyncer(TestCase): def test_uri_parse(self): self.assertEqual(darcs.darcs_syncer.parse_uri("darcs+http://dar"), "http://dar") self.assertRaises(base.uri_exception, darcs.darcs_syncer.parse_uri, "darcs://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "darcs+http://foon.com/dar") o = valid("/tmp/foon", "darcs+http://dar") self.assertEqual(o.uri, "http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from pkgcore.sync import base, cvs bogus = make_bogus_syncer(cvs.cvs_syncer) valid = make_valid_syncer(cvs.cvs_syncer) class TestcvsParsing(TestCase): def test_parse(self): self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "cvs+hopefully_nonexistent_binary://foon.com/dar") o = valid("/tmp/foon", "cvs://dar:module") self.assertEqual(o.uri, ":anoncvs:dar") self.assertEqual(o.module, "module") self.assertEqual(o.rsh, None) self.assertEqual(o.env, {"CVSROOT":":anoncvs:dar"}) o = valid("/tmp/foon", "cvs+pserver://dar:module") self.assertEqual(o.uri, ":pserver:dar") self.assertEqual(o.module, "module") self.assertEqual(o.rsh, None) self.assertEqual(o.env, {"CVSROOT":":pserver:dar"}) o = valid("/tmp/foon", "cvs+/bin/sh://dar:module") self.assertEqual(o.rsh, "/bin/sh") self.assertEqual(o.uri, ":ext:dar") self.assertEqual(sorted(o.env.iteritems()),
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from pkgcore.sync import base, cvs bogus = make_bogus_syncer(cvs.cvs_syncer) valid = make_valid_syncer(cvs.cvs_syncer) class TestcvsParsing(TestCase): def test_parse(self): self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "cvs+hopefully_nonexistant_binary://foon.com/dar") o = valid("/tmp/foon", "cvs://dar:module") self.assertEqual(o.uri, ":anoncvs:dar") self.assertEqual(o.module, "module") self.assertEqual(o.rsh, None) self.assertEqual(o.env, {"CVSROOT":":anoncvs:dar"}) o = valid("/tmp/foon", "cvs+pserver://dar:module") self.assertEqual(o.uri, ":pserver:dar") self.assertEqual(o.module, "module") self.assertEqual(o.rsh, None) self.assertEqual(o.env, {"CVSROOT":":pserver:dar"}) o = valid("/tmp/foon", "cvs+/bin/sh://dar:module") self.assertEqual(o.rsh, "/bin/sh") self.assertEqual(o.uri, ":ext:dar") self.assertEqual(sorted(o.env.iteritems()),
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.sync import base, svn from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer bogus = make_bogus_syncer(svn.svn_syncer) valid = make_valid_syncer(svn.svn_syncer) class TestSVNSyncer(TestCase): def test_uri_parse(self): self.assertRaises(base.uri_exception, svn.svn_syncer.parse_uri, "svn+://dar") self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "svn+http://foon.com/dar") o = valid("/tmp/foon", "svn+http://dar") self.assertEqual(o.uri, "svn+http://dar")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD import pwd from pkgcore.test import TestCase, SkipTest from pkgcore.sync import base, svn from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from pkgcore.os_data import root_uid valid = make_valid_syncer(base.ExternalSyncer) bogus = make_bogus_syncer(base.ExternalSyncer) existing_user = pwd.getpwall()[0].pw_name existing_uid = pwd.getpwnam(existing_user).pw_uid class TestBase(TestCase): def test_init(self): self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "http://dar") o = valid("/tmp/foon", "http://dar") self.assertEqual(o.local_user, root_uid) self.assertEqual(o.uri, "http://dar") o = valid("/tmp/foon", "http://%s::@site" % existing_user) self.assertEqual(o.local_user, existing_uid) self.assertEqual(o.uri, "http://site") o = valid("/tmp/foon", "http://%s::foon@site" % existing_user) self.assertEqual(o.local_user, existing_uid) self.assertEqual(o.uri, "http://foon@site")
# Copyright: 2006 Brian Harring <*****@*****.**> # License: GPL2/BSD from pkgcore.test import TestCase from pkgcore.test.sync import make_bogus_syncer, make_valid_syncer from pkgcore.sync import base, rsync bogus = make_bogus_syncer(rsync.rsync_syncer) valid = make_valid_syncer(rsync.rsync_syncer) class TestrsyncParsing(TestCase): def test_parse(self): self.assertRaises(base.syncer_exception, bogus, "/tmp/foon", "rsync+hopefully_nonexistent_binary://foon.com/dar") o = valid("/tmp/foon", "rsync://dar/module") self.assertEqual(o.rsh, None) self.assertEqual(o.uri, "rsync://dar/module/") o = valid("/tmp/foon", "rsync+/bin/sh://dar/module") self.assertEqual(o.uri, "rsync://dar/module/") self.assertEqual(o.rsh, "/bin/sh")