summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2012-03-11 00:25:57 +0100
committerKai Blin <kai@samba.org>2012-03-11 02:27:45 +0100
commit26a0e7a3f5ba7f8d6af2d2b8d7a6acf1323e8c57 (patch)
treebcf9a42b972bcfee3eb050e40678ae75a55b4bca /source4/scripting/python
parent1e6ef242ec65e4f8e9c8ffa44a09581b28c2599a (diff)
downloadsamba-26a0e7a3f5ba7f8d6af2d2b8d7a6acf1323e8c57.tar.gz
samba-26a0e7a3f5ba7f8d6af2d2b8d7a6acf1323e8c57.tar.bz2
samba-26a0e7a3f5ba7f8d6af2d2b8d7a6acf1323e8c57.zip
s4 dns: Test deleting records and fix a small bu
Autobuild-User: Kai Blin <kai@samba.org> Autobuild-Date: Sun Mar 11 02:27:45 CET 2012 on sn-devel-104
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/tests/dns.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/source4/scripting/python/samba/tests/dns.py b/source4/scripting/python/samba/tests/dns.py
index 8285139a92..ff973bde05 100644
--- a/source4/scripting/python/samba/tests/dns.py
+++ b/source4/scripting/python/samba/tests/dns.py
@@ -429,6 +429,45 @@ class DNSTest(TestCase):
self.assertEquals(response.answers[0].rdata.txt, '"This is a test" "and this is a test, too"')
+ def test_delete_record(self):
+ "Test if deleting records works"
+ p = self.make_name_packet(dns.DNS_OPCODE_UPDATE)
+ updates = []
+
+ name = self.get_dns_domain()
+
+ u = self.make_name_question(name, dns.DNS_QTYPE_SOA, dns.DNS_QCLASS_IN)
+ updates.append(u)
+ self.finish_name_packet(p, updates)
+
+ updates = []
+ r = dns.res_rec()
+ r.name = "textrec.%s" % self.get_dns_domain()
+ r.rr_type = dns.DNS_QTYPE_TXT
+ r.rr_class = dns.DNS_QCLASS_NONE
+ r.ttl = 0
+ r.length = 0xffff
+ r.rdata = dns.txt_record()
+ r.rdata.txt = '"This is a test"'
+ updates.append(r)
+ p.nscount = len(updates)
+ p.nsrecs = updates
+
+ response = self.dns_transaction_udp(p)
+ self.assert_dns_rcode_equals(response, dns.DNS_RCODE_OK)
+
+ p = self.make_name_packet(dns.DNS_OPCODE_QUERY)
+ questions = []
+
+ name = "textrec.%s" % self.get_dns_domain()
+ q = self.make_name_question(name, dns.DNS_QTYPE_TXT, dns.DNS_QCLASS_IN)
+ questions.append(q)
+
+ self.finish_name_packet(p, questions)
+ response = self.dns_transaction_udp(p)
+ self.assert_dns_rcode_equals(response, dns.DNS_RCODE_NXDOMAIN)
+
+
if __name__ == "__main__":
import unittest
unittest.main()