diff options
author | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-08-16 08:56:00 +0000 |
---|---|---|
committer | Tiago Gomes <tiago.gomes@codethink.co.uk> | 2013-08-16 13:05:18 +0000 |
commit | 10a788b3642608de1c0ecc7a41055f950c0652dd (patch) | |
tree | 587e3438b5acd5e2566b00102cec29369efb0ba2 /morphlib/morph2_tests.py | |
parent | 2514eb9717ab6f8161d1fb403ca2bfff9e1169ea (diff) | |
download | morph-10a788b3642608de1c0ecc7a41055f950c0652dd.tar.gz |
Add support for a `cluster` type of morphology.
Add the necessary tests to keep CoverageTestRunner happy.
Diffstat (limited to 'morphlib/morph2_tests.py')
-rw-r--r-- | morphlib/morph2_tests.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/morphlib/morph2_tests.py b/morphlib/morph2_tests.py index 9de23e56..bf32d3c2 100644 --- a/morphlib/morph2_tests.py +++ b/morphlib/morph2_tests.py @@ -379,3 +379,61 @@ class MorphologyTests(unittest.TestCase): ''') cmds = m.get_commands('build-commands') self.assertEqual(cmds, []) + + ## Cluster morphologies tests + + def test_parses_simple_cluster_morph(self): + m = Morphology(''' + name: foo + kind: cluster + systems: + - morph: bar + ''') + self.assertEqual(m['name'], 'foo') + self.assertEqual(m['kind'], 'cluster') + self.assertEqual(m['systems'][0]['morph'], 'bar') + + def test_fails_without_systems(self): + text = ''' + name: foo + kind: cluster + ''' + self.assertRaises(KeyError, Morphology, text) + + def test_fails_with_empty_systems(self): + text = ''' + name: foo + kind: cluster + systems: + ''' + self.assertRaises(ValueError, Morphology, text) + + def test_fails_without_morph(self): + text = ''' + name: foo + kind: cluster + systems: + - deploy: + ''' + self.assertRaises(KeyError, Morphology, text) + + def test_fails_with_invalid_deploy_defaults(self): + text = ''' + name: foo + kind: cluster + systems: + - morph: bar + deploy-defaults: ooops_i_am_not_a_mapping + ''' + self.assertRaises(ValueError, Morphology, text) + + def test_fails_with_invalid_deployment_params(self): + text = ''' + name: foo + kind: cluster + systems: + - morph: bar + deploy: + qux: ooops_i_am_not_a_mapping + ''' + self.assertRaises(ValueError, Morphology, text) |