def test_delete_no_entry(self): with patch.object(driver.DesignateDriverV2, '_get_records', MagicMock(return_value=self.records)): dns_driver = driver.DesignateDriverV2() self.assertRaises(exception.DnsRecordNotFound, dns_driver.delete_entry, 'nothere', 'A') self.mock_client.recordsets.assert_not_called()
def test_create_entry(self): dns_driver = driver.DesignateDriverV2() zone = driver.DesignateDnsZone( id='22222222-2222-2222-2222-222222222222', name='www.trove.com') entry = base_driver.DnsEntry(name='www.example.com', content='None', type='A', ttl=3600, priority=None, dns_zone=zone) dns_driver.create_entry(entry, '1.2.3.4') self.mock_client.recordsets.create.assert_called_once_with( driver.DNS_DOMAIN_ID, entry.name + '.', entry.type, records=['1.2.3.4'])
def test_delete_entry(self): with patch.object(driver.DesignateDriverV2, '_get_records', MagicMock(return_value=self.records)): dns_driver = driver.DesignateDriverV2() dns_driver.delete_entry('record1', 'A') self.mock_client.recordsets.delete(driver.DNS_DOMAIN_ID)