summaryrefslogtreecommitdiff
path: root/morphlib/cachedir_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-09-29 14:40:47 +0100
committerLars Wirzenius <liw@liw.fi>2011-09-29 14:40:47 +0100
commitca50eed4c902a3454cf7210eeeb818f28d6e7e2a (patch)
treee47b8b237e1aaa3dee236633d279b8bff93ba439 /morphlib/cachedir_tests.py
parente8f1882ce8236081ba7a6cc716cff0754e8a438a (diff)
downloadmorph-ca50eed4c902a3454cf7210eeeb818f28d6e7e2a.tar.gz
Add generation of filenames in the cache directory.
Diffstat (limited to 'morphlib/cachedir_tests.py')
-rw-r--r--morphlib/cachedir_tests.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/morphlib/cachedir_tests.py b/morphlib/cachedir_tests.py
index 17fa6e0f..b9f7c80b 100644
--- a/morphlib/cachedir_tests.py
+++ b/morphlib/cachedir_tests.py
@@ -56,3 +56,34 @@ class CacheDirTests(unittest.TestCase):
self.assertNotEqual(self.cachedir.key(dict_key_1),
self.cachedir.key(dict_key_2))
+ def test_returns_a_chunk_pathname_in_cache_directory(self):
+ dict_key = {
+ 'kind': 'chunk',
+ 'ref': 'DEADBEEF',
+ 'repo': 'git://git.baserock.org/hello/',
+ 'arch': 'armel',
+ }
+ pathname = self.cachedir.name(dict_key)
+ self.assert_(pathname.startswith(self.cachedir.dirname + '/'))
+ self.assert_(pathname.endswith('.chunk'))
+
+ def test_returns_a_stratum_pathname_in_cache_directory(self):
+ dict_key = {
+ 'kind': 'stratum',
+ 'ref': 'DEADBEEF',
+ 'repo': 'git://git.baserock.org/hello/',
+ 'arch': 'armel',
+ }
+ pathname = self.cachedir.name(dict_key)
+ self.assert_(pathname.startswith(self.cachedir.dirname + '/'))
+ self.assert_(pathname.endswith('.stratum'))
+
+ def test_returns_a_valid_pathname_in_cache_directory(self):
+ dict_key = {
+ 'ref': 'DEADBEEF',
+ 'repo': 'git://git.baserock.org/hello/',
+ 'arch': 'armel',
+ }
+ pathname = self.cachedir.name(dict_key)
+ self.assert_(pathname.startswith(self.cachedir.dirname + '/'))
+