Exemple #1
0
    def test_delete(self):
        """
        Test to delete a DNS record.
        """
        file_data = salt.utils.json.dumps({"A": "B"})

        class MockAnswer:
            def __init__(self, *args, **kwargs):
                self.answer = [{"address": "localhost"}]

            def rcode(self):
                return 0

        def mock_udp_query(*args, **kwargs):
            return MockAnswer

        with patch.object(dns.query, "udp", mock_udp_query()):
            with patch("salt.utils.files.fopen",
                       mock_open(read_data=file_data),
                       create=True):
                with patch.object(dns.tsigkeyring,
                                  "from_text",
                                  return_value=True):
                    with patch.object(ddns, "_get_keyring", return_value=None):
                        with patch.object(ddns, "_config", return_value=None):
                            self.assertTrue(ddns.delete(zone="A", name="B"))
Exemple #2
0
    def test_delete(self):
        '''
        Test to delete a DNS record.
        '''
        file_data = json.dumps({'A': 'B'})

        class MockAnswer(object):
            def __init__(self, *args, **kwargs):
                self.answer = [{'address': 'localhost'}]

            def rcode(self):
                return 0

        def mock_udp_query(*args, **kwargs):
            return MockAnswer

        with patch.object(dns.query, 'udp', mock_udp_query()):
            with patch('salt.utils.fopen',
                       mock_open(read_data=file_data),
                       create=True):
                with patch.object(dns.tsigkeyring,
                                  'from_text',
                                  return_value=True):
                    with patch.object(ddns, '_get_keyring', return_value=None):
                        with patch.object(ddns, '_config', return_value=None):
                            self.assertTrue(ddns.delete(zone='A', name='B'))
Exemple #3
0
    def test_delete(self):
        '''
        Test to delete a DNS record.
        '''
        file_data = json.dumps({'A': 'B'})

        class MockAnswer(object):
            def __init__(self, *args, **kwargs):
                self.answer = [{'address': 'localhost'}]

            def rcode(self):
                return 0

        def mock_udp_query(*args, **kwargs):
            return MockAnswer

        with patch.object(dns.query, 'udp', mock_udp_query()):
            with patch('salt.utils.fopen', mock_open(read_data=file_data), create=True):
                with patch.object(dns.tsigkeyring, 'from_text', return_value=True):
                    with patch.object(ddns, '_get_keyring', return_value=None):
                        with patch.object(ddns, '_config', return_value=None):
                            self.assertTrue(ddns.delete(zone='A', name='B'))