Пример #1
0
    def test_set(self):
        '''
        Test to set debconf selections
        '''
        name = 'nullmailer'
        data = {
            'shared/mailname': {
                'type': 'string',
                'value': 'server.domain.tld'
            },
            'nullmailer/relayhost': {
                'type': 'string',
                'value': 'mail.domain.tld'
            }
        }

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

        changes = {
            'nullmailer/relayhost': 'New value: mail.domain.tld',
            'shared/mailname': 'New value: server.domain.tld'
        }

        mock = MagicMock(return_value=None)
        with patch.dict(debconfmod.__salt__, {'debconf.show': mock}):
            with patch.dict(debconfmod.__opts__, {'test': True}):
                ret.update({'changes': changes})
                self.assertDictEqual(debconfmod.set(name, data), ret)
Пример #2
0
    def test_set(self):
        """
        Test to set debconf selections
        """
        name = "nullmailer"
        data = {
            "shared/mailname": {
                "type": "string",
                "value": "server.domain.tld"
            },
            "nullmailer/relayhost": {
                "type": "string",
                "value": "mail.domain.tld"
            },
        }

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

        changes = {
            "nullmailer/relayhost": "New value: mail.domain.tld",
            "shared/mailname": "New value: server.domain.tld",
        }

        mock = MagicMock(return_value=None)
        with patch.dict(debconfmod.__salt__, {"debconf.show": mock}):
            with patch.dict(debconfmod.__opts__, {"test": True}):
                ret.update({"changes": changes})
                self.assertDictEqual(debconfmod.set(name, data), ret)
Пример #3
0
    def test_set(self):
        '''
        Test to set debconf selections
        '''
        name = 'nullmailer'
        data = {'shared/mailname': {'type': 'string',
                                    'value': 'server.domain.tld'},
                'nullmailer/relayhost': {'type': 'string',
                                         'value': 'mail.domain.tld'}}

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

        changes = {'nullmailer/relayhost': 'New value: mail.domain.tld',
                   'shared/mailname': 'New value: server.domain.tld'}

        mock = MagicMock(return_value=None)
        with patch.dict(debconfmod.__salt__, {'debconf.show': mock}):
            with patch.dict(debconfmod.__opts__, {'test': True}):
                ret.update({'changes': changes})
                self.assertDictEqual(debconfmod.set(name, data), ret)