From 2f89396d952ac5a4e528f46a3e684824a7f80913 Mon Sep 17 00:00:00 2001 From: Dougal Matthews <dougal@redhat.com> Date: Thu, 24 Nov 2016 13:56:33 +0000 Subject: [PATCH] Mock the HTTP action in the with_items tests At the moment it attempts to access http://www.example.com. This causes a DNS lookup which will fail in some build environments. Change-Id: Ia89db5382eacacead8e2f937ebee5af4b68ca218 --- mistral/tests/unit/engine/test_with_items.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mistral/tests/unit/engine/test_with_items.py b/mistral/tests/unit/engine/test_with_items.py index 0642ecfe1..575fe6237 100644 --- a/mistral/tests/unit/engine/test_with_items.py +++ b/mistral/tests/unit/engine/test_with_items.py @@ -13,10 +13,12 @@ # limitations under the License. import copy +import mock from oslo_config import cfg import testtools from mistral.actions import base as action_base +from mistral.actions import std_actions from mistral.db.v2 import api as db_api from mistral import exceptions as exc from mistral.services import workbooks as wb_service @@ -1255,7 +1257,9 @@ class WithItemsEngineTest(base.EngineTestCase): self.assertListEqual(sorted(result), sorted(names)) - def test_with_items_and_adhoc_action(self): + @mock.patch.object(std_actions.HTTPAction, 'run') + def test_with_items_and_adhoc_action(self, mock_http_action): + wb_text = """--- version: "2.0" @@ -1314,3 +1318,5 @@ class WithItemsEngineTest(base.EngineTestCase): self.assertEqual(2, len(task_execs)) self.assertEqual(states.SUCCESS, task1_ex.state) self.assertEqual(states.SUCCESS, task2_ex.state) + + self.assertEqual(1, mock_http_action.call_count)