summaryrefslogtreecommitdiff
path: root/morphlib/localartifactcache_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-10-05 13:16:16 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-10-05 13:16:16 +0100
commitfac22b615d4904bc7bcaf01962bf984f65f1159c (patch)
tree8dee61ac1595bcd64baa10fcdab4a2a032a2c488 /morphlib/localartifactcache_tests.py
parent7d6094ed068f16d6fd5a51aa201865efbc364669 (diff)
downloadmorph-fac22b615d4904bc7bcaf01962bf984f65f1159c.tar.gz
Add a way for a local artifact cache to clear itself
Diffstat (limited to 'morphlib/localartifactcache_tests.py')
-rw-r--r--morphlib/localartifactcache_tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/morphlib/localartifactcache_tests.py b/morphlib/localartifactcache_tests.py
index 8e25e5c9..36b5e891 100644
--- a/morphlib/localartifactcache_tests.py
+++ b/morphlib/localartifactcache_tests.py
@@ -142,3 +142,16 @@ class LocalArtifactCacheTests(unittest.TestCase):
self.assertEqual(stored_metadata,
'source log line 1\nsource log line 2\n')
+
+ def test_clears_artifact_cache(self):
+ cache = morphlib.localartifactcache.LocalArtifactCache(
+ self.tempdir.dirname)
+
+ handle = cache.put(self.runtime_artifact)
+ handle.write('runtime')
+ handle.close()
+
+ self.assertTrue(cache.has(self.runtime_artifact))
+ cache.clear()
+ self.assertFalse(cache.has(self.runtime_artifact))
+