summaryrefslogtreecommitdiff
path: root/morphlib/cachekeycomputer_tests.py
diff options
context:
space:
mode:
authorRichard Maw <richard.maw@codethink.co.uk>2012-12-03 16:52:22 +0000
committerRichard Maw <richard.maw@codethink.co.uk>2012-12-03 16:54:15 +0000
commit2115e5caac731ad3a483cbb863e2b371f7a6e7d5 (patch)
treea2c664a98822939713f12833766edf4e873a50ff /morphlib/cachekeycomputer_tests.py
parent49b67bb0150aa1854457243e12289efd1c7fe408 (diff)
downloadmorph-2115e5caac731ad3a483cbb863e2b371f7a6e7d5.tar.gz
Test source pool having duplicates added
The lookup method will only find the first entry, but previously would allow later entries to be found by iterating.
Diffstat (limited to 'morphlib/cachekeycomputer_tests.py')
-rw-r--r--morphlib/cachekeycomputer_tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/morphlib/cachekeycomputer_tests.py b/morphlib/cachekeycomputer_tests.py
index d4355172..411ad3f5 100644
--- a/morphlib/cachekeycomputer_tests.py
+++ b/morphlib/cachekeycomputer_tests.py
@@ -189,3 +189,12 @@ class CacheKeyComputerTests(unittest.TestCase):
old_sha = self.ckc.compute_key(old_artifact)
new_sha = self.ckc.compute_key(new_artifact)
self.assertEqual(old_sha, new_sha)
+
+ def test_same_morphology_added_to_source_pool_only_appears_once(self):
+ src = morphlib.source.Source('repo', 'original/ref', 'sha', 'tree',
+ '{"name": "chunk", "kind": "chunk"}',
+ 'chunk.morph')
+ sp = morphlib.sourcepool.SourcePool()
+ sp.add(src)
+ sp.add(src)
+ self.assertEqual(1, len([s for s in sp if s == src]))