From 7f92797a27eb620b2b5cd331d3a060df67223c2e Mon Sep 17 00:00:00 2001 From: Kelvin Liu Date: Fri, 13 Sep 2019 14:35:30 +1000 Subject: [PATCH] Add more tests; --- charmtools/charms.py | 1 + tests/test_charm_proof.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/charmtools/charms.py b/charmtools/charms.py index facc2ac7..3a4f3414 100644 --- a/charmtools/charms.py +++ b/charmtools/charms.py @@ -717,6 +717,7 @@ def validate_deployment(charm, linter): deployment = charm['deployment'] if not isinstance(deployment, dict): linter.err('deployment: must be a dict of config') + return known_field_types = { 'type': str, diff --git a/tests/test_charm_proof.py b/tests/test_charm_proof.py index 0a5ee30a..2040b99f 100644 --- a/tests/test_charm_proof.py +++ b/tests/test_charm_proof.py @@ -831,6 +831,18 @@ def test_deployment(self): validate_deployment(charm, linter) self.assertFalse(linter.err.called) + def test_invalid_deployment(self): + """Charm has invalid deployment.""" + linter = Mock() + charm = { + 'deployment': [], + } + validate_deployment(charm, linter) + self.assertEqual(linter.err.call_count, 1) + linter.err.assert_has_calls([ + call('deployment: must be a dict of config'), + ], any_order=True) + def test_deployment_unsupported_field(self): """Charm has the invalid deployment field.""" linter = Mock()