summaryrefslogtreecommitdiff
path: root/morphlib/morphologyfactory_tests.py
diff options
context:
space:
mode:
authorLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-19 17:14:12 +0100
committerLars Wirzenius <lars.wirzenius@codethink.co.uk>2012-07-19 17:31:19 +0100
commitdfaf624b1fb97c2208bf03b9ff314c5566575e5f (patch)
treee927fd50ea4e087fbb23b8fac9893b36d6f4d11c /morphlib/morphologyfactory_tests.py
parentdf8eda23514d8a6490c8a891f7deb5fcb9ad856c (diff)
downloadmorph-dfaf624b1fb97c2208bf03b9ff314c5566575e5f.tar.gz
Require system-kind on system morphologies
Diffstat (limited to 'morphlib/morphologyfactory_tests.py')
-rw-r--r--morphlib/morphologyfactory_tests.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/morphlib/morphologyfactory_tests.py b/morphlib/morphologyfactory_tests.py
index 91768843..cc45bb21 100644
--- a/morphlib/morphologyfactory_tests.py
+++ b/morphlib/morphologyfactory_tests.py
@@ -16,6 +16,7 @@
import unittest
+import morphlib
from morphlib.morph2 import Morphology
from morphlib.morphologyfactory import (MorphologyFactory,
AutodetectError,
@@ -59,17 +60,20 @@ class FakeLocalRepo(object):
'system.morph': '''{
"name": "foo-system",
"kind": "system",
+ "system-kind": "%(system_kind)s",
"arch": "%(arch)s"
}''',
}
def __init__(self):
self.arch = 'unknown'
+ self.system_kind = 'unknown'
def cat(self, sha1, filename):
if filename in self.morphologies:
values = {
'arch': self.arch,
+ 'system_kind': self.system_kind,
}
return self.morphologies[filename] % values
elif filename.endswith('.morph'):
@@ -221,3 +225,8 @@ class MorphologyFactoryTests(unittest.TestCase):
morph = self.mf.get_morphology('reponame', 'sha1', 'system.morph')
self.assertEqual(morph.needs_artifact_metadata_cached, False)
+ def test_fails_if_system_does_not_define_system_kind(self):
+ self.lr.system_kind = ''
+ self.assertRaises(morphlib.Error, self.mf.get_morphology,
+ 'reponame', 'sha1', 'system.morph')
+