예제 #1
0
    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,
                    },
                )
예제 #2
0
    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
                    })
예제 #3
0
파일: event_test.py 프로젝트: DaveQB/salt
    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
                                      })