(self)
| 53 | |
| 54 | class 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 |
nothing calls this directly
no test coverage detected