コード例 #1
0
    def test_absent(self):
        '''
        Test to ensures that the named DNS record is absent.
        '''
        name = 'webserver'
        zone = 'example.com'
        data = '111.222.333.444'

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

        with patch.dict(ddns.__opts__, {'test': True}):
            comt = ('None record "{0}" will be deleted'.format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(ddns.absent(name, zone, data), ret)

            with patch.dict(ddns.__opts__, {'test': False}):
                mock = MagicMock(return_value=None)
                with patch.dict(ddns.__salt__, {'ddns.delete': mock}):
                    comt = ('No matching DNS record(s) present')
                    ret.update({'comment': comt, 'result': True})
                    self.assertDictEqual(ddns.absent(name, zone, data), ret)
コード例 #2
0
def test_absent():
    """
    Test to ensures that the named DNS record is absent.
    """
    name = "webserver"
    zone = "example.com"
    data = "111.222.333.444"

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

    with patch.dict(ddns.__opts__, {"test": True}):
        comt = 'None record "{}" will be deleted'.format(name)
        ret.update({"comment": comt})
        assert ddns.absent(name, zone, data) == ret

        with patch.dict(ddns.__opts__, {"test": False}):
            mock = MagicMock(return_value=None)
            with patch.dict(ddns.__salt__, {"ddns.delete": mock}):
                comt = "No matching DNS record(s) present"
                ret.update({"comment": comt, "result": True})
                assert ddns.absent(name, zone, data) == ret
コード例 #3
0
ファイル: ddns_test.py プロジェクト: DaveQB/salt
    def test_absent(self):
        '''
        Test to ensures that the named DNS record is absent.
        '''
        name = 'webserver'
        zone = 'example.com'
        data = '111.222.333.444'

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

        with patch.dict(ddns.__opts__, {'test': True}):
            comt = ('None record "{0}" will be deleted'.format(name))
            ret.update({'comment': comt})
            self.assertDictEqual(ddns.absent(name, zone, data), ret)

            with patch.dict(ddns.__opts__, {'test': False}):
                mock = MagicMock(return_value=None)
                with patch.dict(ddns.__salt__, {'ddns.delete': mock}):
                    comt = ('No matching DNS record(s) present')
                    ret.update({'comment': comt, 'result': True})
                    self.assertDictEqual(ddns.absent(name, zone, data), ret)