summaryrefslogtreecommitdiff
path: root/lib/dnspython/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-08-27 16:07:52 +0200
committerJelmer Vernooij <jelmer@samba.org>2011-08-27 17:40:39 +0200
commit8bd71350abe48fdcfc0125e48fa97abdf31e1270 (patch)
tree2873d7fc77f9ec1992e24886a9feae80b48ffaef /lib/dnspython/tests
parentbd01a8e79faa3d657f01529c063cd0e09d711880 (diff)
downloadsamba-8bd71350abe48fdcfc0125e48fa97abdf31e1270.tar.gz
samba-8bd71350abe48fdcfc0125e48fa97abdf31e1270.tar.bz2
samba-8bd71350abe48fdcfc0125e48fa97abdf31e1270.zip
dnspython: Update to latest upstream snapshot.
Autobuild-User: Jelmer Vernooij <jelmer@samba.org> Autobuild-Date: Sat Aug 27 17:40:39 CEST 2011 on sn-devel-104
Diffstat (limited to 'lib/dnspython/tests')
-rw-r--r--lib/dnspython/tests/Makefile2
-rw-r--r--lib/dnspython/tests/bugs.py2
-rw-r--r--lib/dnspython/tests/dnssec.py2
-rw-r--r--lib/dnspython/tests/example41
-rw-r--r--lib/dnspython/tests/example1.good9
-rw-r--r--lib/dnspython/tests/example2.good9
-rw-r--r--lib/dnspython/tests/flags.py2
-rw-r--r--lib/dnspython/tests/message.py2
-rw-r--r--lib/dnspython/tests/name.py6
-rw-r--r--lib/dnspython/tests/namedict.py2
-rw-r--r--lib/dnspython/tests/ntoaaton.py99
-rw-r--r--lib/dnspython/tests/rdtypeandclass.py2
-rw-r--r--lib/dnspython/tests/resolver.py2
-rw-r--r--lib/dnspython/tests/rrset.py2
-rw-r--r--lib/dnspython/tests/set.py2
-rw-r--r--lib/dnspython/tests/tokenizer.py2
-rw-r--r--lib/dnspython/tests/update.py2
-rw-r--r--lib/dnspython/tests/zone.py2
18 files changed, 109 insertions, 81 deletions
diff --git a/lib/dnspython/tests/Makefile b/lib/dnspython/tests/Makefile
index 584f6a7da7..6ab444f451 100644
--- a/lib/dnspython/tests/Makefile
+++ b/lib/dnspython/tests/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/bugs.py b/lib/dnspython/tests/bugs.py
index 0896e3f02d..c2fa6b6659 100644
--- a/lib/dnspython/tests/bugs.py
+++ b/lib/dnspython/tests/bugs.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2006, 2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/dnssec.py b/lib/dnspython/tests/dnssec.py
index b30e847fba..7b4546a086 100644
--- a/lib/dnspython/tests/dnssec.py
+++ b/lib/dnspython/tests/dnssec.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2010 Nominum, Inc.
+# Copyright (C) 2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/example b/lib/dnspython/tests/example
index e8fed1161b..2f753a2f75 100644
--- a/lib/dnspython/tests/example
+++ b/lib/dnspython/tests/example
@@ -101,16 +101,17 @@ isdn01 ISDN "isdn-address"
isdn02 ISDN "isdn-address" "subaddress"
isdn03 ISDN "isdn-address"
isdn04 ISDN "isdn-address" "subaddress"
-key01 KEY 512 255 1 (
- AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
- yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
- GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
- jqf0BaqHT+8= )
-key02 KEY HOST|FLAG4 DNSSEC RSAMD5 (
- AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
- yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
- GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
- jqf0BaqHT+8= )
+;; dnspython no longer supports old DNSSEC
+;;key01 KEY 512 255 1 (
+;; AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
+;; yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
+;; GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
+;; jqf0BaqHT+8= )
+;;key02 KEY HOST|FLAG4 DNSSEC RSAMD5 (
+;; AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
+;; yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
+;; GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
+;; jqf0BaqHT+8= )
kx01 KX 10 kdc
kx02 KX 10 .
loc01 LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
@@ -137,10 +138,10 @@ nsap-ptr01 NSAP-PTR foo.
NSAP-PTR .
nsap01 NSAP 0x47000580005a0000000001e133ffffff00016100
nsap02 NSAP 0x47.000580005a0000000001e133ffffff000161.00
-nxt01 NXT a.secure ( NS SOA MX SIG KEY LOC NXT )
-nxt02 NXT . ( NSAP-PTR NXT )
-nxt03 NXT . ( A )
-nxt04 NXT . ( 127 )
+;;nxt01 NXT a.secure ( NS SOA MX SIG KEY LOC NXT )
+;;nxt02 NXT . ( NSAP-PTR NXT )
+;;nxt03 NXT . ( A )
+;;nxt04 NXT . ( 127 )
ptr01 PTR example.
px01 PX 65535 foo. bar.
px02 PX 65535 . .
@@ -154,11 +155,11 @@ $ORIGIN s.example.
ns A 73.80.65.49
$ORIGIN example.
$TTL 3600 ; 1 hour
-sig01 SIG NXT 1 3 3600 (
- 20200101000000 20030101000000 2143 foo
- MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi
- WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl
- d80jEeC8aTrO+KKmCaY= )
+;;sig01 SIG NXT 1 3 3600 (
+;; 20200101000000 20030101000000 2143 foo
+;; MxFcby9k/yvedMfQgKzhH5er0Mu/vILz45IkskceFGgi
+;; WCn/GxHhai6VAuHAoNUz4YoU1tVfSCSqQYn6//11U6Nl
+;; d80jEeC8aTrO+KKmCaY= )
srv01 SRV 0 0 0 .
srv02 SRV 65535 65535 65535 old-slow-box.example.com.
$TTL 301 ; 5 minutes 1 second
@@ -202,7 +203,7 @@ dnskey01 DNSKEY 512 255 1 (
yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
jqf0BaqHT+8= )
-dnskey02 DNSKEY HOST|FLAG4 DNSSEC RSAMD5 (
+dnskey02 DNSKEY 257 3 RSAMD5 (
AQMFD5raczCJHViKtLYhWGz8hMY9UGRuniJDBzC7w0aR
yzWZriO6i2odGWWQVucZqKVsENW91IOW4vqudngPZsY3
GvQ/xVA8/7pyFj6b7Esga60zyGW6LFe9r8n6paHrlG5o
diff --git a/lib/dnspython/tests/example1.good b/lib/dnspython/tests/example1.good
index ca5ead6379..0834d17150 100644
--- a/lib/dnspython/tests/example1.good
+++ b/lib/dnspython/tests/example1.good
@@ -27,7 +27,7 @@ dname01 3600 IN DNAME dname-target.
dname02 3600 IN DNAME dname-target
dname03 3600 IN DNAME .
dnskey01 3600 IN DNSKEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-dnskey02 3600 IN DNSKEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
+dnskey02 3600 IN DNSKEY 257 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
ds01 3600 IN DS 12345 3 1 123456789abcdef67890123456789abcdef67890
e 300 IN MX 10 mail
e 300 IN TXT "one"
@@ -51,8 +51,6 @@ isdn01 3600 IN ISDN "isdn-address"
isdn02 3600 IN ISDN "isdn-address" "subaddress"
isdn03 3600 IN ISDN "isdn-address"
isdn04 3600 IN ISDN "isdn-address" "subaddress"
-key01 3600 IN KEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-key02 3600 IN KEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
kx01 3600 IN KX 10 kdc
kx02 3600 IN KX 10 .
loc01 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
@@ -77,10 +75,6 @@ nsec301 3600 IN NSEC3 1 1 12 aabbccdd 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA MX
nsec302 3600 IN NSEC3 1 1 12 - 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA MX RRSIG DNSKEY NSEC3PARAM
nsec3param01 3600 IN NSEC3PARAM 1 1 12 aabbccdd
nsec3param02 3600 IN NSEC3PARAM 1 1 12 -
-nxt01 3600 IN NXT a.secure NS SOA MX SIG KEY LOC NXT
-nxt02 3600 IN NXT . NSAP-PTR NXT
-nxt03 3600 IN NXT . A
-nxt04 3600 IN NXT . TYPE127
ptr01 3600 IN PTR @
px01 3600 IN PX 65535 foo. bar.
px02 3600 IN PX 65535 . .
@@ -91,7 +85,6 @@ rt01 3600 IN RT 0 intermediate-host
rt02 3600 IN RT 65535 .
s 300 IN NS ns.s
ns.s 300 IN A 73.80.65.49
-sig01 3600 IN SIG NXT 1 3 3600 20200101000000 20030101000000 2143 foo MxFcby9k/yvedMfQgKzhH5er0Mu/vILz 45IkskceFGgiWCn/GxHhai6VAuHAoNUz 4YoU1tVfSCSqQYn6//11U6Nld80jEeC8 aTrO+KKmCaY=
spf 3600 IN SPF "v=spf1 mx -all"
srv01 3600 IN SRV 0 0 0 .
srv02 3600 IN SRV 65535 65535 65535 old-slow-box.example.com.
diff --git a/lib/dnspython/tests/example2.good b/lib/dnspython/tests/example2.good
index c923c09b7c..de4bcd59fd 100644
--- a/lib/dnspython/tests/example2.good
+++ b/lib/dnspython/tests/example2.good
@@ -27,7 +27,7 @@ dname01.example. 3600 IN DNAME dname-target.
dname02.example. 3600 IN DNAME dname-target.example.
dname03.example. 3600 IN DNAME .
dnskey01.example. 3600 IN DNSKEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-dnskey02.example. 3600 IN DNSKEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
+dnskey02.example. 3600 IN DNSKEY 257 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
ds01.example. 3600 IN DS 12345 3 1 123456789abcdef67890123456789abcdef67890
e.example. 300 IN MX 10 mail.example.
e.example. 300 IN TXT "one"
@@ -51,8 +51,6 @@ isdn01.example. 3600 IN ISDN "isdn-address"
isdn02.example. 3600 IN ISDN "isdn-address" "subaddress"
isdn03.example. 3600 IN ISDN "isdn-address"
isdn04.example. 3600 IN ISDN "isdn-address" "subaddress"
-key01.example. 3600 IN KEY 512 255 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
-key02.example. 3600 IN KEY 2560 3 1 AQMFD5raczCJHViKtLYhWGz8hMY9UGRu niJDBzC7w0aRyzWZriO6i2odGWWQVucZ qKVsENW91IOW4vqudngPZsY3GvQ/xVA8 /7pyFj6b7Esga60zyGW6LFe9r8n6paHr lG5ojqf0BaqHT+8=
kx01.example. 3600 IN KX 10 kdc.example.
kx02.example. 3600 IN KX 10 .
loc01.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20.00m 2000.00m 20.00m
@@ -77,10 +75,6 @@ nsec301.example. 3600 IN NSEC3 1 1 12 aabbccdd 2t7b4g4vsa5smi47k61mv5bv1a22bojr
nsec302.example. 3600 IN NSEC3 1 1 12 - 2t7b4g4vsa5smi47k61mv5bv1a22bojr NS SOA MX RRSIG DNSKEY NSEC3PARAM
nsec3param01.example. 3600 IN NSEC3PARAM 1 1 12 aabbccdd
nsec3param02.example. 3600 IN NSEC3PARAM 1 1 12 -
-nxt01.example. 3600 IN NXT a.secure.example. NS SOA MX SIG KEY LOC NXT
-nxt02.example. 3600 IN NXT . NSAP-PTR NXT
-nxt03.example. 3600 IN NXT . A
-nxt04.example. 3600 IN NXT . TYPE127
ptr01.example. 3600 IN PTR example.
px01.example. 3600 IN PX 65535 foo. bar.
px02.example. 3600 IN PX 65535 . .
@@ -91,7 +85,6 @@ rt01.example. 3600 IN RT 0 intermediate-host.example.
rt02.example. 3600 IN RT 65535 .
s.example. 300 IN NS ns.s.example.
ns.s.example. 300 IN A 73.80.65.49
-sig01.example. 3600 IN SIG NXT 1 3 3600 20200101000000 20030101000000 2143 foo.example. MxFcby9k/yvedMfQgKzhH5er0Mu/vILz 45IkskceFGgiWCn/GxHhai6VAuHAoNUz 4YoU1tVfSCSqQYn6//11U6Nld80jEeC8 aTrO+KKmCaY=
spf.example. 3600 IN SPF "v=spf1 mx -all"
srv01.example. 3600 IN SRV 0 0 0 .
srv02.example. 3600 IN SRV 65535 65535 65535 old-slow-box.example.com.
diff --git a/lib/dnspython/tests/flags.py b/lib/dnspython/tests/flags.py
index 7ee2d8e12e..b3cf6716bc 100644
--- a/lib/dnspython/tests/flags.py
+++ b/lib/dnspython/tests/flags.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/message.py b/lib/dnspython/tests/message.py
index 7134661d3a..931bb1977d 100644
--- a/lib/dnspython/tests/message.py
+++ b/lib/dnspython/tests/message.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/name.py b/lib/dnspython/tests/name.py
index 1ab4f52814..e30e43d3a2 100644
--- a/lib/dnspython/tests/name.py
+++ b/lib/dnspython/tests/name.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
@@ -662,12 +662,12 @@ class NameTestCase(unittest.TestCase):
def testBadReverseIPv4(self):
def bad():
n = dns.reversename.from_address('127.0.foo.1')
- self.failUnlessRaises(socket.error, bad)
+ self.failUnlessRaises(dns.exception.SyntaxError, bad)
def testBadReverseIPv6(self):
def bad():
n = dns.reversename.from_address('::1::1')
- self.failUnlessRaises(socket.error, bad)
+ self.failUnlessRaises(dns.exception.SyntaxError, bad)
def testForwardIPv4(self):
n = dns.name.from_text('1.0.0.127.in-addr.arpa.')
diff --git a/lib/dnspython/tests/namedict.py b/lib/dnspython/tests/namedict.py
index 0261142186..e256bfe679 100644
--- a/lib/dnspython/tests/namedict.py
+++ b/lib/dnspython/tests/namedict.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/ntoaaton.py b/lib/dnspython/tests/ntoaaton.py
index 77befd26e3..9d8bedd702 100644
--- a/lib/dnspython/tests/ntoaaton.py
+++ b/lib/dnspython/tests/ntoaaton.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
@@ -16,141 +16,182 @@
import unittest
import dns.exception
+import dns.ipv4
import dns.ipv6
+# for convenience
+aton4 = dns.ipv4.inet_aton
+ntoa4 = dns.ipv4.inet_ntoa
+aton6 = dns.ipv6.inet_aton
+ntoa6 = dns.ipv6.inet_ntoa
+
+v4_bad_addrs = ['256.1.1.1', '1.1.1', '1.1.1.1.1', '01.1.1.1',
+ '+1.1.1.1', '1.1.1.1+', '1..2.3.4', '.1.2.3.4',
+ '1.2.3.4.']
+
class NtoAAtoNTestCase(unittest.TestCase):
def test_aton1(self):
- a = dns.ipv6.inet_aton('::')
+ a = aton6('::')
self.failUnless(a == '\x00' * 16)
def test_aton2(self):
- a = dns.ipv6.inet_aton('::1')
+ a = aton6('::1')
self.failUnless(a == '\x00' * 15 + '\x01')
def test_aton3(self):
- a = dns.ipv6.inet_aton('::10.0.0.1')
+ a = aton6('::10.0.0.1')
self.failUnless(a == '\x00' * 12 + '\x0a\x00\x00\x01')
def test_aton4(self):
- a = dns.ipv6.inet_aton('abcd::dcba')
+ a = aton6('abcd::dcba')
self.failUnless(a == '\xab\xcd' + '\x00' * 12 + '\xdc\xba')
def test_aton5(self):
- a = dns.ipv6.inet_aton('1:2:3:4:5:6:7:8')
+ a = aton6('1:2:3:4:5:6:7:8')
self.failUnless(a == \
'00010002000300040005000600070008'.decode('hex_codec'))
def test_bad_aton1(self):
def bad():
- a = dns.ipv6.inet_aton('abcd:dcba')
+ a = aton6('abcd:dcba')
self.failUnlessRaises(dns.exception.SyntaxError, bad)
def test_bad_aton2(self):
def bad():
- a = dns.ipv6.inet_aton('abcd::dcba::1')
+ a = aton6('abcd::dcba::1')
self.failUnlessRaises(dns.exception.SyntaxError, bad)
def test_bad_aton3(self):
def bad():
- a = dns.ipv6.inet_aton('1:2:3:4:5:6:7:8:9')
+ a = aton6('1:2:3:4:5:6:7:8:9')
self.failUnlessRaises(dns.exception.SyntaxError, bad)
def test_aton1(self):
- a = dns.ipv6.inet_aton('::')
+ a = aton6('::')
self.failUnless(a == '\x00' * 16)
def test_aton2(self):
- a = dns.ipv6.inet_aton('::1')
+ a = aton6('::1')
self.failUnless(a == '\x00' * 15 + '\x01')
def test_aton3(self):
- a = dns.ipv6.inet_aton('::10.0.0.1')
+ a = aton6('::10.0.0.1')
self.failUnless(a == '\x00' * 12 + '\x0a\x00\x00\x01')
def test_aton4(self):
- a = dns.ipv6.inet_aton('abcd::dcba')
+ a = aton6('abcd::dcba')
self.failUnless(a == '\xab\xcd' + '\x00' * 12 + '\xdc\xba')
def test_ntoa1(self):
b = '00010002000300040005000600070008'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '1:2:3:4:5:6:7:8')
def test_ntoa2(self):
b = '\x00' * 16
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::')
def test_ntoa3(self):
b = '\x00' * 15 + '\x01'
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::1')
def test_ntoa4(self):
b = '\x80' + '\x00' * 15
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '8000::')
def test_ntoa5(self):
b = '\x01\xcd' + '\x00' * 12 + '\x03\xef'
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '1cd::3ef')
def test_ntoa6(self):
b = 'ffff00000000ffff000000000000ffff'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == 'ffff:0:0:ffff::ffff')
def test_ntoa7(self):
b = '00000000ffff000000000000ffffffff'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '0:0:ffff::ffff:ffff')
def test_ntoa8(self):
b = 'ffff0000ffff00000000ffff00000000'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == 'ffff:0:ffff::ffff:0:0')
def test_ntoa9(self):
b = '0000000000000000000000000a000001'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::10.0.0.1')
def test_ntoa10(self):
b = '0000000000000000000000010a000001'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::1:a00:1')
def test_ntoa11(self):
b = '00000000000000000000ffff0a000001'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::ffff:10.0.0.1')
def test_ntoa12(self):
b = '000000000000000000000000ffffffff'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::255.255.255.255')
def test_ntoa13(self):
b = '00000000000000000000ffffffffffff'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::ffff:255.255.255.255')
def test_ntoa14(self):
b = '0000000000000000000000000001ffff'.decode('hex_codec')
- t = dns.ipv6.inet_ntoa(b)
+ t = ntoa6(b)
self.failUnless(t == '::0.1.255.255')
def test_bad_ntoa1(self):
def bad():
- a = dns.ipv6.inet_ntoa('')
+ a = ntoa6('')
self.failUnlessRaises(ValueError, bad)
def test_bad_ntoa2(self):
def bad():
- a = dns.ipv6.inet_ntoa('\x00' * 17)
+ a = ntoa6('\x00' * 17)
self.failUnlessRaises(ValueError, bad)
+ def test_good_v4_aton(self):
+ pairs = [('1.2.3.4', '\x01\x02\x03\x04'),
+ ('255.255.255.255', '\xff\xff\xff\xff'),
+ ('0.0.0.0', '\x00\x00\x00\x00')]
+ for (t, b) in pairs:
+ b1 = aton4(t)
+ t1 = ntoa4(b1)
+ self.failUnless(b1 == b)
+ self.failUnless(t1 == t)
+
+ def test_bad_v4_aton(self):
+ def make_bad(a):
+ def bad():
+ return aton4(a)
+ return bad
+ for addr in v4_bad_addrs:
+ self.failUnlessRaises(dns.exception.SyntaxError, make_bad(addr))
+
+ def test_bad_v6_aton(self):
+ addrs = ['+::0', '0::0::', '::0::', '1:2:3:4:5:6:7:8:9',
+ ':::::::']
+ embedded = ['::' + x for x in v4_bad_addrs]
+ addrs.extend(embedded)
+ def make_bad(a):
+ def bad():
+ x = aton6(a)
+ return bad
+ for addr in addrs:
+ self.failUnlessRaises(dns.exception.SyntaxError, make_bad(addr))
+
if __name__ == '__main__':
unittest.main()
diff --git a/lib/dnspython/tests/rdtypeandclass.py b/lib/dnspython/tests/rdtypeandclass.py
index 0c8a830e27..f3c0628d36 100644
--- a/lib/dnspython/tests/rdtypeandclass.py
+++ b/lib/dnspython/tests/rdtypeandclass.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/resolver.py b/lib/dnspython/tests/resolver.py
index bd6dc5fbc2..28d5a42cdf 100644
--- a/lib/dnspython/tests/resolver.py
+++ b/lib/dnspython/tests/resolver.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/rrset.py b/lib/dnspython/tests/rrset.py
index 3cafbee891..be1324b0ec 100644
--- a/lib/dnspython/tests/rrset.py
+++ b/lib/dnspython/tests/rrset.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/set.py b/lib/dnspython/tests/set.py
index e2bca51b82..583d20cfa0 100644
--- a/lib/dnspython/tests/set.py
+++ b/lib/dnspython/tests/set.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/tokenizer.py b/lib/dnspython/tests/tokenizer.py
index 4f4a1bdc90..1d561ae1b5 100644
--- a/lib/dnspython/tests/tokenizer.py
+++ b/lib/dnspython/tests/tokenizer.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/update.py b/lib/dnspython/tests/update.py
index 5f7b31f23f..92ddb565fc 100644
--- a/lib/dnspython/tests/update.py
+++ b/lib/dnspython/tests/update.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
diff --git a/lib/dnspython/tests/zone.py b/lib/dnspython/tests/zone.py
index 075be0a48a..31e7405b0f 100644
--- a/lib/dnspython/tests/zone.py
+++ b/lib/dnspython/tests/zone.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
+# Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,