summaryrefslogtreecommitdiff
path: root/morphlib/repoaliasresolver_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2013-01-29 15:46:02 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2013-02-11 14:12:14 +0000
commit8c6c178bbe73c35bee15359b72e0cb816cbd48f9 (patch)
treedaa7f112af815855b355407d6c592e0bff8d61cd /morphlib/repoaliasresolver_tests.py
parent6047fce7f234db6a26dcd7b704636906290a48a5 (diff)
downloadmorph-8c6c178bbe73c35bee15359b72e0cb816cbd48f9.tar.gz
repoaliasresolver: compile patterns on creation
This also involved codifying it ignoring malformed aliases. Such behaviour was implemented before, but wasn't obvious. The restructuring made it have a line of code of its own, which meant it needed unit testing.
Diffstat (limited to 'morphlib/repoaliasresolver_tests.py')
-rw-r--r--morphlib/repoaliasresolver_tests.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/morphlib/repoaliasresolver_tests.py b/morphlib/repoaliasresolver_tests.py
index 21421878..04b9e695 100644
--- a/morphlib/repoaliasresolver_tests.py
+++ b/morphlib/repoaliasresolver_tests.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012 Codethink Limited
+# Copyright (C) 2012-2013 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -81,3 +81,10 @@ class RepoAliasResolverTests(unittest.TestCase):
self.resolver.pull_url('append:bar'), 'git://append/bar')
self.assertEqual(
self.resolver.push_url('append:bar'), 'git@append/bar')
+
+ def test_ignores_malformed_aliases(self):
+ resolver = morphlib.repoaliasresolver.RepoAliasResolver([
+ 'malformed=git://git.malformed.url.org'
+ ])
+ self.assertEqual(resolver.pull_url('malformed:foo'), 'malformed:foo')
+ self.assertEqual(resolver.push_url('malformed:foo'), 'malformed:foo')