def test_absent(self):
        """
        Test to ensure the named cloudwatch alarm is deleted.
        """
        name = "my test alarm"

        ret = {"name": name, "result": None, "changes": {}, "comment": ""}

        mock = MagicMock(side_effect=[True, False])
        with patch.dict(boto_cloudwatch_alarm.__salt__,
                        {"boto_cloudwatch.get_alarm": mock}):
            with patch.dict(boto_cloudwatch_alarm.__opts__, {"test": True}):
                comt = "alarm {} is set to be removed.".format(name)
                ret.update({"comment": comt})
                assert boto_cloudwatch_alarm.absent(name) == ret

                comt = "my test alarm does not exist in None."
                ret.update({"comment": comt, "result": True})
                assert boto_cloudwatch_alarm.absent(name) == ret
Esempio n. 2
0
    def test_absent(self):
        '''
        Test to ensure the named cloudwatch alarm is deleted.
        '''
        name = 'my test alarm'

        ret = {'name': name, 'result': None, 'changes': {}, 'comment': ''}

        mock = MagicMock(side_effect=[True, False])
        with patch.dict(boto_cloudwatch_alarm.__salt__,
                        {'boto_cloudwatch.get_alarm': mock}):
            with patch.dict(boto_cloudwatch_alarm.__opts__, {'test': True}):
                comt = ('alarm {0} is set to be removed.'.format(name))
                ret.update({'comment': comt})
                self.assertDictEqual(boto_cloudwatch_alarm.absent(name), ret)

                comt = ('my test alarm does not exist in None.')
                ret.update({'comment': comt, 'result': True})
                self.assertDictEqual(boto_cloudwatch_alarm.absent(name), ret)
Esempio n. 3
0
    def test_absent(self):
        '''
        Test to ensure the named cloudwatch alarm is deleted.
        '''
        name = 'my test alarm'

        ret = {'name': name,
               'result': None,
               'changes': {},
               'comment': ''}

        mock = MagicMock(side_effect=[True, False])
        with patch.dict(boto_cloudwatch_alarm.__salt__,
                        {'boto_cloudwatch.get_alarm': mock}):
            with patch.dict(boto_cloudwatch_alarm.__opts__, {'test': True}):
                comt = ('alarm {0} is set to be removed.'.format(name))
                ret.update({'comment': comt})
                self.assertDictEqual(boto_cloudwatch_alarm.absent(name), ret)

                comt = ('my test alarm does not exist in None.')
                ret.update({'comment': comt, 'result': True})
                self.assertDictEqual(boto_cloudwatch_alarm.absent(name), ret)