summaryrefslogtreecommitdiff
path: root/morphlib/localrepocache_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-04-10 13:00:38 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-04-10 13:00:38 +0100
commit8a9d16e11494b0671480719ede416c0c2b555a3b (patch)
tree911c7e6b13fcfc24bcf5dc7421b3f014f63a396c /morphlib/localrepocache_tests.py
parentb1c6d2e4069ad466e8982236f4ca8611b24040cb (diff)
downloadmorph-8a9d16e11494b0671480719ede416c0c2b555a3b.tar.gz
Create cache directory when needed in LocalRepoCache
Diffstat (limited to 'morphlib/localrepocache_tests.py')
-rw-r--r--morphlib/localrepocache_tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/morphlib/localrepocache_tests.py b/morphlib/localrepocache_tests.py
index 6ab5d7c5..72f000f9 100644
--- a/morphlib/localrepocache_tests.py
+++ b/morphlib/localrepocache_tests.py
@@ -40,6 +40,7 @@ class LocalRepoCacheTests(unittest.TestCase):
self.lrc._git = self.fake_git
self.lrc._exists = self.fake_exists
self.lrc._fetch = self.not_found
+ self.lrc._mkdir = self.fake_mkdir
self.lrc._remove = self.fake_remove
def fake_git(self, args):
@@ -57,6 +58,9 @@ class LocalRepoCacheTests(unittest.TestCase):
def fake_exists(self, filename):
return filename in self.cache
+ def fake_mkdir(self, dirname):
+ self.cache.add(dirname)
+
def fake_remove(self, filename):
self.removed.append(filename)
@@ -84,6 +88,13 @@ class LocalRepoCacheTests(unittest.TestCase):
self.assertTrue(self.lrc.has_repo(self.reponame))
self.assertTrue(self.lrc.has_repo(self.repourl))
+ def test_cachedir_does_not_exist_initially(self):
+ self.assertFalse(self.cachedir in self.cache)
+
+ def test_creates_cachedir_if_missing(self):
+ self.lrc.cache_repo(self.repourl)
+ self.assertTrue(self.cachedir in self.cache)
+
def test_happily_caches_same_repo_twice(self):
self.lrc.cache_repo(self.repourl)
self.lrc.cache_repo(self.repourl)