diff options
author | Richard Maw <richard.maw@codethink.co.uk> | 2013-06-07 11:00:08 +0000 |
---|---|---|
committer | Richard Maw <richard.maw@codethink.co.uk> | 2013-06-07 12:30:39 +0000 |
commit | 40cdee7b390a3f9efeb7dd4ecb547cdc513474b4 (patch) | |
tree | 4bce73abe4aee5031b68e0fbc9a5d1d00bcd21e2 /morphlib/localartifactcache_tests.py | |
parent | def5cd6f2a5c037c05173f023239a4d2b0babee0 (diff) | |
download | morph-40cdee7b390a3f9efeb7dd4ecb547cdc513474b4.tar.gz |
lac_tests: Cover list and delete
Diffstat (limited to 'morphlib/localartifactcache_tests.py')
-rw-r--r-- | morphlib/localartifactcache_tests.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/morphlib/localartifactcache_tests.py b/morphlib/localartifactcache_tests.py index 10f3ab6b..082b926a 100644 --- a/morphlib/localartifactcache_tests.py +++ b/morphlib/localartifactcache_tests.py @@ -157,3 +157,35 @@ class LocalArtifactCacheTests(unittest.TestCase): cache.clear() self.assertFalse(cache.has(self.runtime_artifact)) + def test_put_artifacts_and_list_them_afterwards(self): + cache = morphlib.localartifactcache.LocalArtifactCache( + self.tempdir.dirname) + + handle = cache.put(self.runtime_artifact) + handle.write('runtime') + handle.close() + + self.assertTrue(len(list(cache.list_contents())) == 1) + + handle = cache.put(self.devel_artifact) + handle.write('devel') + handle.close() + + self.assertTrue(len(list(cache.list_contents())) == 1) + + def test_put_artifacts_and_remove_them_afterwards(self): + cache = morphlib.localartifactcache.LocalArtifactCache( + self.tempdir.dirname) + + handle = cache.put(self.runtime_artifact) + handle.write('runtime') + handle.close() + + handle = cache.put(self.devel_artifact) + handle.write('devel') + handle.close() + + key = list(cache.list_contents())[0][0] + cache.remove(key) + + self.assertTrue(len(list(cache.list_contents())) == 0) |