summaryrefslogtreecommitdiff
path: root/morphlib/stagingarea_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-11-29 14:33:30 +0000
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-11-29 14:41:53 +0000
commit92e3d9d415bf180982046f647230493bdf2b86b5 (patch)
tree55ba6b9dd51c45689707e795a3e7a29b4907e72e /morphlib/stagingarea_tests.py
parentc58c9cb5de2c24ee8d92e1e711d3a741dd785459 (diff)
downloadmorph-92e3d9d415bf180982046f647230493bdf2b86b5.tar.gz
Refactor and fix to make it pass (more of) the test suite
Diffstat (limited to 'morphlib/stagingarea_tests.py')
-rw-r--r--morphlib/stagingarea_tests.py19
1 files changed, 17 insertions, 2 deletions
diff --git a/morphlib/stagingarea_tests.py b/morphlib/stagingarea_tests.py
index 3230b9e3..15131272 100644
--- a/morphlib/stagingarea_tests.py
+++ b/morphlib/stagingarea_tests.py
@@ -14,6 +14,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+import cliapp
import os
import shutil
import tarfile
@@ -31,14 +32,28 @@ class FakeSource(object):
}
+class FakeApplication(object):
+
+ def __init__(self, cachedir):
+ self.settings = {
+ 'cachedir': cachedir,
+ }
+
+ def runcmd(self, *args, **kwargs):
+ cliapp.runcmd(*args, **kwargs)
+
+
class StagingAreaTests(unittest.TestCase):
def setUp(self):
self.tempdir = tempfile.mkdtemp()
+ self.cachedir = os.path.join(self.tempdir, 'cachedir')
+ os.mkdir(self.cachedir)
+ os.mkdir(os.path.join(self.cachedir, 'artifacts'))
self.staging = os.path.join(self.tempdir, 'staging')
self.created_dirs = []
- self.sa = morphlib.stagingarea.StagingArea(object(), self.staging,
- self.staging)
+ self.sa = morphlib.stagingarea.StagingArea(
+ FakeApplication(self.cachedir), self.staging, self.staging)
def tearDown(self):
shutil.rmtree(self.tempdir)