示例#1
0
    def test_options_absent(self):
        """
        Test to verify options 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.options_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.options_absent(name), ret)
示例#2
0
    def test_options_absent(self):
        '''
        Test to verify options 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.options_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.options_absent(name), ret)
示例#3
0
    def test_options_absent(self):
        '''
        Test to verify options 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 options under their respective '
                     'sections').format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(ini_manage.options_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.options_absent(name), ret)
示例#4
0
    def test_options_absent(self):
        """
        Test to verify options 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.options_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.options_absent(name), ret)
        original = {
            "Tables": {
                "key1": "1",
                "key2": "2",
                "key3": "3",
                "key4": "4"
            }
        }
        sections = {"Tables": ["key2", "key3"]}
        changes = {"Tables": {"key2": "2", "key3": "3"}}
        with patch.dict(
                ini_manage.__salt__,
            {"ini.remove_option": MagicMock(side_effect=["2", "3"])},
        ):
            with patch.dict(ini_manage.__opts__, {"test": False}):
                comt = "Changes take effect"
                ret.update({
                    "comment": comt,
                    "result": True,
                    "changes": changes
                })
                self.assertDictEqual(ini_manage.options_absent(name, sections),
                                     ret)
示例#5
0
    def test_options_absent(self):
        '''
        Test to verify options 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 options under their respective '
                     'sections').format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(ini_manage.options_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.options_absent(name), ret)