Пример #1
0
    def test_sections_absent(self):
        '''
        Test to verify sections absent in file.
        '''
        name = 'salt'

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

        with patch.dict(ini_manage.__opts__, {'test': True}):
            comt = 'No changes detected.'
            ret.update({'comment': comt, 'result': True})
            self.assertDictEqual(ini_manage.sections_absent(name), ret)

        with patch.dict(ini_manage.__opts__, {'test': False}):
            comt = ('No anomaly detected')
            ret.update({'comment': comt, 'result': True})
            self.assertDictEqual(ini_manage.sections_absent(name), ret)
Пример #2
0
    def test_sections_absent(self):
        '''
        Test to verify sections absent in file.
        '''
        name = 'salt'

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

        with patch.dict(ini_manage.__opts__, {'test': True}):
            comt = (('ini file {0} shall be validated for absence of '
                     'given sections').format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(ini_manage.sections_absent(name), ret)

        with patch.dict(ini_manage.__opts__, {'test': False}):
            comt = ('No anomaly detected')
            ret.update({'comment': comt, 'result': True})
            self.assertDictEqual(ini_manage.sections_absent(name), ret)
Пример #3
0
    def test_sections_absent(self):
        """
        Test to verify sections absent in file.
        """
        name = "salt"

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

        with patch.dict(ini_manage.__opts__, {"test": True}):
            with patch.dict(ini_manage.__salt__,
                            {"ini.get_ini": MagicMock(return_value=None)}):
                comt = "No changes detected."
                ret.update({"comment": comt, "result": True})
                self.assertDictEqual(ini_manage.sections_absent(name), ret)

        with patch.dict(ini_manage.__opts__, {"test": False}):
            comt = "No anomaly detected"
            ret.update({"comment": comt, "result": True})
            self.assertDictEqual(ini_manage.sections_absent(name), ret)
Пример #4
0
    def test_sections_absent(self):
        '''
        Test to verify sections absent in file.
        '''
        name = 'salt'

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

        with patch.dict(ini_manage.__opts__, {'test': True}):
            comt = (('ini file {0} shall be validated for absence of '
                     'given sections').format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(ini_manage.sections_absent(name), ret)

        with patch.dict(ini_manage.__opts__, {'test': False}):
            comt = ('No anomaly detected')
            ret.update({'comment': comt, 'result': True})
            self.assertDictEqual(ini_manage.sections_absent(name), ret)