def test_send(self): """ Test to send an event to the Salt Master """ with patch.dict(event.__opts__, {"test": True}): self.assertDictEqual( event.send("salt"), { "changes": { "data": None, "tag": "salt" }, "comment": "Event would have been fired", "name": "salt", "result": None, }, ) with patch.dict(event.__opts__, {"test": False}): mock = MagicMock(return_value=True) with patch.dict(event.__salt__, {"event.send": mock}): self.assertDictEqual( event.send("salt"), { "changes": { "data": None, "tag": "salt" }, "comment": "Event fired", "name": "salt", "result": True, }, )
def test_send(self): ''' Test to send an event to the Salt Master ''' with patch.dict(event.__opts__, {'test': True}): self.assertDictEqual( event.send("salt"), { 'changes': { 'data': None, 'tag': 'salt' }, 'comment': 'Event would have been fired', 'name': 'salt', 'result': None }) with patch.dict(event.__opts__, {'test': False}): mock = MagicMock(return_value=True) with patch.dict(event.__salt__, {'event.send': mock}): self.assertDictEqual( event.send("salt"), { 'changes': { 'data': None, 'tag': 'salt' }, 'comment': 'Event fired', 'name': 'salt', 'result': True })
def test_send(self): ''' Test to send an event to the Salt Master ''' with patch.dict(event.__opts__, {'test': True}): self.assertDictEqual(event.send("salt"), {'changes': {'data': None, 'tag': 'salt'}, 'comment': 'Event would have been fired', 'name': 'salt', 'result': None } ) with patch.dict(event.__opts__, {'test': False}): mock = MagicMock(return_value=True) with patch.dict(event.__salt__, {'event.send': mock}): self.assertDictEqual(event.send("salt"), {'changes': {'data': None, 'tag': 'salt'}, 'comment': 'Event fired', 'name': 'salt', 'result': True })