From 799cd173c654b733ec4ab2c2774ed1720a8cef3a Mon Sep 17 00:00:00 2001 From: David Wilson Date: Wed, 17 Aug 2016 12:11:26 +0100 Subject: [PATCH] One more test case. --- tests/responder_test.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/responder_test.py b/tests/responder_test.py index 104b84c9..405c65a0 100644 --- a/tests/responder_test.py +++ b/tests/responder_test.py @@ -35,6 +35,20 @@ class GoodModulesTest(testlib.BrokerMixin, unittest.TestCase): class BrokenModulesTest(unittest.TestCase): + def test_obviously_missing(self): + # Ensure we don't crash in the case of a module legitimately being + # unavailable. Should never happen in the real world. + + context = mock.Mock() + responder = econtext.master.ModuleResponder(context) + responder.get_module((50, 'non_existent_module')) + self.assertEquals(1, len(context.enqueue.mock_calls)) + + call = context.enqueue.mock_calls[0] + reply_to, data = call[1] + self.assertEquals(50, reply_to) + self.assertTrue(data is None) + def test_ansible_six_messed_up_path(self): # The copy of six.py shipped with Ansible appears in a package whose # __path__ subsequently ends up empty, which prevents pkgutil from