summaryrefslogtreecommitdiff
path: root/morphlib
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-05-03 14:09:49 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-05-04 14:24:07 +0100
commit223475d1059e15ee75366354ab1a88dfdf2afac0 (patch)
tree20b529daaf576906e31b4714bb6380e3e9e49e26 /morphlib
parentc2767ba11c3df7da52bcdca8979afbced644a428 (diff)
downloadmorph-223475d1059e15ee75366354ab1a88dfdf2afac0.tar.gz
Add tests for repo-alias expansion
Diffstat (limited to 'morphlib')
-rw-r--r--morphlib/localrepocache.py6
-rw-r--r--morphlib/localrepocache_tests.py7
2 files changed, 13 insertions, 0 deletions
diff --git a/morphlib/localrepocache.py b/morphlib/localrepocache.py
index a3e28d57..a5487cd9 100644
--- a/morphlib/localrepocache.py
+++ b/morphlib/localrepocache.py
@@ -185,6 +185,12 @@ class LocalRepoCache(object):
path = self._cache_name(repourl)
yield repourl, path
+ def pull_url(self, reponame):
+ '''Expand a possibly shortened repo name to a pull url.'''
+
+ def push_url(self, reponame):
+ '''Expand a possibly shortened repo name to a push url.'''
+
def has_repo(self, reponame):
'''Have we already got a cache of a given repo?'''
for repourl, path in self._base_iterate(reponame):
diff --git a/morphlib/localrepocache_tests.py b/morphlib/localrepocache_tests.py
index dfa92518..5ee28a99 100644
--- a/morphlib/localrepocache_tests.py
+++ b/morphlib/localrepocache_tests.py
@@ -27,6 +27,7 @@ class LocalRepoCacheTests(unittest.TestCase):
bundle_base_url = 'http://lorry.example.com/bundles/'
self.reponame = 'upstream:reponame'
self.repourl = 'git://example.com/reponame'
+ self.pushurl = 'example.com:reponame.git'
escaped_url = 'git___example_com_reponame'
self.bundle_url = '%s%s.bndl' % (bundle_base_url, escaped_url)
self.cachedir = '/cache/dir'
@@ -77,6 +78,12 @@ class LocalRepoCacheTests(unittest.TestCase):
self.cache.add(path)
return True
+ def test_expands_shortened_url_correctly_for_pulling(self):
+ self.assertEqual(self.lrc.pull_url(self.reponame), self.repourl)
+
+ def test_expands_shortened_url_correctly_for_pushing(self):
+ self.assertEqual(self.lrc.push_url(self.reponame), self.repourl)
+
def test_has_not_got_shortened_repo_initially(self):
self.assertFalse(self.lrc.has_repo(self.reponame))