MCPcopy Create free account
hub / github.com/StackStorm/st2 / setUp

Method setUp

st2reactor/tests/unit/test_sensor_service.py:55–69  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

53
54class SensorServiceTestCase(unittest.TestCase):
55 def setUp(self):
56 def side_effect(trigger, payload, trace_context):
57 self._dispatched_count += 1
58
59 self.sensor_service = SensorService(mock.MagicMock())
60 self.sensor_service._trigger_dispatcher_service._dispatcher = mock.Mock()
61 self.sensor_service._trigger_dispatcher_service._dispatcher.dispatch = (
62 mock.MagicMock(side_effect=side_effect)
63 )
64 self._dispatched_count = 0
65
66 # Previously, cfg.CONF.system.validate_trigger_payload was set to False explicitly
67 # here. Instead, we store original value so that the default is used, and if unit
68 # test modifies this, we can set it to what it was (preserve test atomicity)
69 self.validate_trigger_payload = cfg.CONF.system.validate_trigger_payload
70
71 def tearDown(self):
72 # Replace original configured value for payload validation

Callers

nothing calls this directly

Calls 1

SensorServiceClass · 0.90

Tested by

no test coverage detected