Browse Source

[1866] adjusted test cases so they pass with new RRType/Class constants

JINMEI Tatuya 12 years ago
parent
commit
56e9d0e542

+ 2 - 2
src/lib/dns/python/tests/message_python_test.py

@@ -304,8 +304,8 @@ class MessageTest(unittest.TestCase):
         self.assertRaises(TypeError, self.r.clear, 3)
 
     def test_clear_question_section(self):
-        self.r.add_question(Question(Name("www.example.com"), RRClass.IN(),
-                                     RRType.A()))
+        self.r.add_question(Question(Name("www.example.com"), RRClass.IN,
+                                     RRType.A))
         self.assertEqual(1, self.r.get_rr_count(Message.SECTION_QUESTION))
         self.r.clear_section(Message.SECTION_QUESTION)
         self.assertEqual(0, self.r.get_rr_count(Message.SECTION_QUESTION))

+ 23 - 23
src/lib/dns/python/tests/nsec3hash_python_test.py

@@ -24,9 +24,9 @@ class NSEC3HashTest(unittest.TestCase):
 
     def setUp(self):
         self.nsec3_common = "2T7B4G4VSA5SMI47K61MV5BV1A22BOJR A RRSIG"
-        self.test_hash = NSEC3Hash(Rdata(RRType.NSEC3PARAM(), RRClass.IN(),
+        self.test_hash = NSEC3Hash(Rdata(RRType.NSEC3PARAM, RRClass.IN,
                                          "1 0 12 aabbccdd"))
-        self.test_hash_nsec3 = NSEC3Hash(Rdata(RRType.NSEC3(), RRClass.IN(),
+        self.test_hash_nsec3 = NSEC3Hash(Rdata(RRType.NSEC3, RRClass.IN,
                                                "1 0 12 aabbccdd " +
                                                self.nsec3_common))
     def test_bad_construct(self):
@@ -37,20 +37,20 @@ class NSEC3HashTest(unittest.TestCase):
         self.assertRaises(TypeError, NSEC3Hash, "1 0 12 aabbccdd")
 
         # additional parameter
-        self.assertRaises(TypeError, NSEC3Hash, Rdata(RRType.NSEC3PARAM(),
-                                                      RRClass.IN(),
+        self.assertRaises(TypeError, NSEC3Hash, Rdata(RRType.NSEC3PARAM,
+                                                      RRClass.IN,
                                                       "1 0 12 aabbccdd"), 1)
 
         # Invaid type of RDATA
-        self.assertRaises(TypeError, NSEC3Hash, Rdata(RRType.A(), RRClass.IN(),
+        self.assertRaises(TypeError, NSEC3Hash, Rdata(RRType.A, RRClass.IN,
                                                       "192.0.2.1"))
 
     def test_unknown_algorithm(self):
         self.assertRaises(UnknownNSEC3HashAlgorithm, NSEC3Hash,
-                          Rdata(RRType.NSEC3PARAM(), RRClass.IN(),
+                          Rdata(RRType.NSEC3PARAM, RRClass.IN,
                                 "2 0 12 aabbccdd"))
         self.assertRaises(UnknownNSEC3HashAlgorithm, NSEC3Hash,
-                          Rdata(RRType.NSEC3(), RRClass.IN(),
+                          Rdata(RRType.NSEC3, RRClass.IN,
                                 "2 0 12 aabbccdd " + self.nsec3_common))
 
     def calculate_check(self, hash):
@@ -71,15 +71,15 @@ class NSEC3HashTest(unittest.TestCase):
 
         # Using unusually large iterations, something larger than the 8-bit
         #range.  (expected hash value generated by BIND 9's dnssec-signzone)
-        self.test_hash = NSEC3Hash(Rdata(RRType.NSEC3PARAM(),
-                                         RRClass.IN(), "1 0 256 AABBCCDD"))
+        self.test_hash = NSEC3Hash(Rdata(RRType.NSEC3PARAM,
+                                         RRClass.IN, "1 0 256 AABBCCDD"))
         self.assertEqual("COG6A52MJ96MNMV3QUCAGGCO0RHCC2Q3",
                          self.test_hash.calculate(Name("example.org")))
 
         # Some boundary cases: 0-iteration and empty salt.  Borrowed from the
         # .com zone data.
-        self.test_hash = NSEC3Hash(Rdata(RRType.NSEC3PARAM(),
-                                         RRClass.IN(),"1 0 0 -"))
+        self.test_hash = NSEC3Hash(Rdata(RRType.NSEC3PARAM,
+                                         RRClass.IN,"1 0 0 -"))
         self.assertEqual("CK0POJMG874LJREF7EFN8430QVIT8BSM",
                          self.test_hash.calculate(Name("com")))
 
@@ -90,39 +90,39 @@ class NSEC3HashTest(unittest.TestCase):
 
     def check_match(self, hash, rrtype, postfix):
         # If all parameters match, it's considered to be matched.
-        self.assertTrue(hash.match(Rdata(rrtype, RRClass.IN(),
+        self.assertTrue(hash.match(Rdata(rrtype, RRClass.IN,
                                          "1 0 12 aabbccdd" + postfix)))
         # Algorithm doesn't match
-        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN(),
+        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN,
                                           "2 0 12 aabbccdd" + postfix)))
         # Iterations doesn't match
-        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN(),
+        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN,
                                           "1 0 1 aabbccdd" + postfix)))
         # Salt doesn't match
-        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN(),
+        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN,
                                           "1 0 12 aabbccde" + postfix)))
         # Salt doesn't match: the other has an empty salt
-        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN(),
+        self.assertFalse(hash.match(Rdata(rrtype, RRClass.IN,
                                           "1 0 12 -" + postfix)))
         # Flag doesn't matter
-        self.assertTrue(hash.match(Rdata(rrtype, RRClass.IN(),
+        self.assertTrue(hash.match(Rdata(rrtype, RRClass.IN,
                                          "1 1 12 aabbccdd" + postfix)))
 
     def test_match(self):
-        self.check_match(self.test_hash, RRType.NSEC3(),
+        self.check_match(self.test_hash, RRType.NSEC3,
                          " " + self.nsec3_common)
-        self.check_match(self.test_hash_nsec3, RRType.NSEC3(),
+        self.check_match(self.test_hash_nsec3, RRType.NSEC3,
                          " " + self.nsec3_common)
-        self.check_match(self.test_hash, RRType.NSEC3PARAM(), "")
-        self.check_match(self.test_hash_nsec3, RRType.NSEC3PARAM(), "")
+        self.check_match(self.test_hash, RRType.NSEC3PARAM, "")
+        self.check_match(self.test_hash_nsec3, RRType.NSEC3PARAM, "")
 
         # bad parameter checks
         self.assertRaises(TypeError, self.test_hash.match, 1)
         self.assertRaises(TypeError, self.test_hash.match,
-                          Rdata(RRType.NSEC3(), RRClass.IN(),
+                          Rdata(RRType.NSEC3, RRClass.IN,
                                 "1 0 12 aabbccdd " + self.nsec3_common), 1)
         self.assertRaises(TypeError, self.test_hash.match,
-                          Rdata(RRType.A(), RRClass.IN(), "192.0.2.1"))
+                          Rdata(RRType.A, RRClass.IN, "192.0.2.1"))
 
 if __name__ == '__main__':
     unittest.main()

+ 10 - 10
src/lib/dns/python/tests/rrclass_python_test.py

@@ -23,8 +23,8 @@ from pydnspp import *
 
 class RRClassTest(unittest.TestCase):
     def setUp(self):
-        self.c1 = RRClass.IN()
-        self.c2 = RRClass.CH()
+        self.c1 = RRClass.IN
+        self.c2 = RRClass.CH
 
     def test_init(self):
         self.assertRaises(InvalidRRClass, RRClass, "wrong")
@@ -81,17 +81,17 @@ class RRClassTest(unittest.TestCase):
     def test_hash(self):
         # Exploiting the knowledge that the hash value is the numeric class
         # value, we can predict the comparison result.
-        self.assertEqual(hash(RRClass.IN()), hash(RRClass("IN")))
+        self.assertEqual(hash(RRClass.IN), hash(RRClass("IN")))
         self.assertEqual(hash(RRClass("in")), hash(RRClass("IN")))
-        self.assertNotEqual(hash(RRClass.IN()), hash(RRClass.CH()))
-        self.assertNotEqual(hash(RRClass.IN()), hash(RRClass("CLASS65535")))
+        self.assertNotEqual(hash(RRClass.IN), hash(RRClass.CH))
+        self.assertNotEqual(hash(RRClass.IN), hash(RRClass("CLASS65535")))
 
     def test_statics(self):
-        self.assertEqual(RRClass.IN(), RRClass("IN"))
-        self.assertEqual(RRClass.CH(), RRClass("CH"))
-        self.assertEqual(RRClass.HS(), RRClass("HS"))
-        self.assertEqual(254, RRClass.NONE().get_code())
-        self.assertEqual(255, RRClass.ANY().get_code())
+        self.assertEqual(RRClass.IN, RRClass("IN"))
+        self.assertEqual(RRClass.CH, RRClass("CH"))
+        self.assertEqual(RRClass.HS, RRClass("HS"))
+        self.assertEqual(254, RRClass.NONE.get_code())
+        self.assertEqual(255, RRClass.ANY.get_code())
 
 if __name__ == '__main__':
     unittest.main()

+ 23 - 23
src/lib/dns/python/tests/rrset_collection_python_test.py

@@ -34,64 +34,64 @@ class RRsetCollectionTest(unittest.TestCase):
         self.assertRaises(TypeError, RRsetCollection, 1)
         self.assertRaises(TypeError, RRsetCollection, # extra arg
                           b'example. 0 A 192.0.2.1',
-                          Name('example'), RRClass.IN(), 1)
+                          Name('example'), RRClass.IN, 1)
         self.assertRaises(TypeError, RRsetCollection, # incorrect order
-                          b'example. 0 A 192.0.2.1', RRClass.IN(),
+                          b'example. 0 A 192.0.2.1', RRClass.IN,
                           Name('example'))
 
         # constructor will result in C++ exception.
         self.assertRaises(IscException, RRsetCollection,
                           TESTDATA_DIR + '/no_such_file', Name('example.org'),
-                          RRClass.IN())
+                          RRClass.IN)
 
     def check_find_result(self, rrsets):
         # Commonly used check pattern
-        found = rrsets.find(Name('www.example.org'), RRClass.IN(), RRType.A())
+        found = rrsets.find(Name('www.example.org'), RRClass.IN, RRType.A)
         self.assertNotEqual(None, found)
         self.assertEqual(Name('www.example.org'), found.get_name())
-        self.assertEqual(RRClass.IN(), found.get_class())
-        self.assertEqual(RRType.A(), found.get_type())
+        self.assertEqual(RRClass.IN, found.get_class())
+        self.assertEqual(RRType.A, found.get_type())
         self.assertEqual('192.0.2.1', found.get_rdata()[0].to_text())
 
     def test_find(self):
         # Checking the underlying find() is called as intended, both for
         # success and failure cases, and with two different constructors.
         rrsets = RRsetCollection(TESTDATA_DIR + '/example.org',
-                                 Name('example.org'), RRClass.IN())
+                                 Name('example.org'), RRClass.IN)
         self.check_find_result(rrsets)
-        self.assertEqual(None, rrsets.find(Name('example.org'), RRClass.IN(),
-                                           RRType.A()))
+        self.assertEqual(None, rrsets.find(Name('example.org'), RRClass.IN,
+                                           RRType.A))
 
         rrsets = RRsetCollection(b'www.example.org. 3600 IN A 192.0.2.1',
-                                 Name('example.org'), RRClass.IN())
+                                 Name('example.org'), RRClass.IN)
         self.check_find_result(rrsets)
-        self.assertEqual(None, rrsets.find(Name('example.org'), RRClass.IN(),
-                                           RRType.A()))
+        self.assertEqual(None, rrsets.find(Name('example.org'), RRClass.IN,
+                                           RRType.A))
 
     def test_find_badargs(self):
         rrsets = RRsetCollection()
 
         # Check bad arguments: bad types
-        self.assertRaises(TypeError, rrsets.find, 1, RRClass.IN(), RRType.A())
+        self.assertRaises(TypeError, rrsets.find, 1, RRClass.IN, RRType.A)
         self.assertRaises(TypeError, rrsets.find, Name('example'), 1,
-                          RRType.A())
+                          RRType.A)
         self.assertRaises(TypeError, rrsets.find, Name('example'), 1,
-                          RRType.A())
+                          RRType.A)
         self.assertRaises(TypeError, rrsets.find, Name('example'),
-                          RRClass.IN(), 1)
-        self.assertRaises(TypeError, rrsets.find, Name('example'), RRType.A(),
-                          RRClass.IN())
+                          RRClass.IN, 1)
+        self.assertRaises(TypeError, rrsets.find, Name('example'), RRType.A,
+                          RRClass.IN)
 
         # Check bad arguments: too many/few arguments
         self.assertRaises(TypeError, rrsets.find, Name('example'),
-                          RRClass.IN(), RRType.A(), 0)
+                          RRClass.IN, RRType.A, 0)
         self.assertRaises(TypeError, rrsets.find, Name('example'),
-                          RRClass.IN())
+                          RRClass.IN)
 
     def test_add_remove_rrset(self):
         name = Name('www.example.org')
-        rrclass = RRClass.IN()
-        rrtype = RRType.A()
+        rrclass = RRClass.IN
+        rrtype = RRType.A
 
         # Create a collection with no RRsets
         rrsets = RRsetCollection()
@@ -134,7 +134,7 @@ class RRsetCollectionTest(unittest.TestCase):
                 pass
         rrsets = EmptyRRsetCollection()
         self.assertRaises(TypeError, rrsets.find, Name('www.example.org'),
-                          RRClass.IN(), RRType.A())
+                          RRClass.IN, RRType.A)
 
 if __name__ == '__main__':
     unittest.main()

+ 22 - 22
src/lib/dns/python/tests/rrtype_python_test.py

@@ -119,35 +119,35 @@ class TestModuleSpec(unittest.TestCase):
     def test_hash(self):
         # Exploiting the knowledge that the hash value is the numeric class
         # value, we can predict the comparison result.
-        self.assertEqual(hash(RRType.AAAA()), hash(RRType("AAAA")))
+        self.assertEqual(hash(RRType.AAAA), hash(RRType("AAAA")))
         self.assertEqual(hash(RRType("aaaa")), hash(RRType("AAAA")))
         self.assertEqual(hash(RRType(28)), hash(RRType("AAAA")))
-        self.assertNotEqual(hash(RRType.A()), hash(RRType.NS()))
-        self.assertNotEqual(hash(RRType.AAAA()), hash(RRType("Type65535")))
+        self.assertNotEqual(hash(RRType.A), hash(RRType.NS))
+        self.assertNotEqual(hash(RRType.AAAA), hash(RRType("Type65535")))
 
     def test_statics(self):
-        self.assertEqual(RRType("NSEC3PARAM"), RRType.NSEC3PARAM())
-        self.assertEqual(RRType("DNAME"), RRType.DNAME())
-        self.assertEqual(RRType("PTR"), RRType.PTR())
-        self.assertEqual(RRType("MX"), RRType.MX())
-        self.assertEqual(RRType("DNSKEY"), RRType.DNSKEY())
-        self.assertEqual(RRType("TXT"), RRType.TXT())
-        self.assertEqual(RRType("RRSIG"), RRType.RRSIG())
-        self.assertEqual(RRType("NSEC"), RRType.NSEC())
-        self.assertEqual(RRType("AAAA"), RRType.AAAA())
-        self.assertEqual(RRType("DS"), RRType.DS())
-        self.assertEqual(RRType("OPT"), RRType.OPT())
-        self.assertEqual(RRType("A"), RRType.A())
-        self.assertEqual(RRType("NS"), RRType.NS())
-        self.assertEqual(RRType("CNAME"), RRType.CNAME())
-        self.assertEqual(RRType("SOA"), RRType.SOA())
-        self.assertEqual(RRType("NSEC3"), RRType.NSEC3())
+        self.assertEqual(RRType("NSEC3PARAM"), RRType.NSEC3PARAM)
+        self.assertEqual(RRType("DNAME"), RRType.DNAME)
+        self.assertEqual(RRType("PTR"), RRType.PTR)
+        self.assertEqual(RRType("MX"), RRType.MX)
+        self.assertEqual(RRType("DNSKEY"), RRType.DNSKEY)
+        self.assertEqual(RRType("TXT"), RRType.TXT)
+        self.assertEqual(RRType("RRSIG"), RRType.RRSIG)
+        self.assertEqual(RRType("NSEC"), RRType.NSEC)
+        self.assertEqual(RRType("AAAA"), RRType.AAAA)
+        self.assertEqual(RRType("DS"), RRType.DS)
+        self.assertEqual(RRType("OPT"), RRType.OPT)
+        self.assertEqual(RRType("A"), RRType.A)
+        self.assertEqual(RRType("NS"), RRType.NS)
+        self.assertEqual(RRType("CNAME"), RRType.CNAME)
+        self.assertEqual(RRType("SOA"), RRType.SOA)
+        self.assertEqual(RRType("NSEC3"), RRType.NSEC3)
 
         # these can't be built with string input
         # (see the original cpp TODO)
-        self.assertEqual(251, RRType.IXFR().get_code())
-        self.assertEqual(252, RRType.AXFR().get_code())
-        self.assertEqual(255, RRType.ANY().get_code())
+        self.assertEqual(251, RRType.IXFR.get_code())
+        self.assertEqual(252, RRType.AXFR.get_code())
+        self.assertEqual(255, RRType.ANY.get_code())
         
 if __name__ == '__main__':
     unittest.main()

+ 14 - 14
src/lib/dns/python/tests/tsig_python_test.py

@@ -40,7 +40,7 @@ class TSIGContextTest(unittest.TestCase):
         self.keyring = TSIGKeyRing()
         self.message = Message(Message.RENDER)
         self.renderer = MessageRenderer()
-        self.test_class = RRClass.IN()
+        self.test_class = RRClass.IN
         self.test_ttl = RRTTL(86400)
         self.secret = base64.b64decode(b"SFuWd/q99SzF8Yzd1QbB9g==")
         self.tsig_ctx = TSIGContext(TSIGKey(self.test_name,
@@ -59,7 +59,7 @@ class TSIGContextTest(unittest.TestCase):
     # Note: intentionally use camelCase so that we can easily copy-paste
     # corresponding C++ tests.
     def createMessageAndSign(self, id, qname, ctx, message_flags=RD_FLAG,
-                             qtype=RRType.A(), answer_data=None,
+                             qtype=RRType.A, answer_data=None,
                              answer_type=None, add_question=True,
                              rcode=Rcode.NOERROR()):
         self.message.clear(Message.RENDER)
@@ -249,7 +249,7 @@ class TSIGContextTest(unittest.TestCase):
         tsig = self.createMessageAndSign(self.qid, self.test_name,
                                          self.tsig_verify_ctx,
                                          QR_FLAG|AA_FLAG|RD_FLAG,
-                                         RRType.A(), "192.0.2.1")
+                                         RRType.A, "192.0.2.1")
 
         expected_mac = b"\x8f\xcd\xa6\x6a\x7c\xd1\xa3\xb9\x94\x8e\xb1\x86" + \
             b"\x9d\x38\x4a\x9f"
@@ -280,7 +280,7 @@ class TSIGContextTest(unittest.TestCase):
         zone_name = Name("example.com")
 
         tsig = self.createMessageAndSign(axfr_qid, zone_name, self.tsig_ctx,
-                                         0, RRType.AXFR())
+                                         0, RRType.AXFR)
 
         received_data = read_wire_data("tsig_verify1.wire")
         self.commonVerifyChecks(self.tsig_verify_ctx, tsig, received_data,
@@ -289,10 +289,10 @@ class TSIGContextTest(unittest.TestCase):
 
         tsig = self.createMessageAndSign(axfr_qid, zone_name,
                                          self.tsig_verify_ctx,
-                                         AA_FLAG|QR_FLAG, RRType.AXFR(),
+                                         AA_FLAG|QR_FLAG, RRType.AXFR,
                                          "ns.example.com. root.example.com." +\
                                          " 2011041503 7200 3600 2592000 1200",
-                                         RRType.SOA())
+                                         RRType.SOA)
 
         received_data = read_wire_data("tsig_verify2.wire")
         self.commonVerifyChecks(self.tsig_ctx, tsig, received_data,
@@ -302,8 +302,8 @@ class TSIGContextTest(unittest.TestCase):
             b"\x60\x34\x13\x09\x68"
         tsig = self.createMessageAndSign(axfr_qid, zone_name,
                                          self.tsig_verify_ctx,
-                                         AA_FLAG|QR_FLAG, RRType.AXFR(),
-                                         "ns.example.com.", RRType.NS(),
+                                         AA_FLAG|QR_FLAG, RRType.AXFR,
+                                         "ns.example.com.", RRType.NS,
                                          False)
         self.commonSignChecks(tsig, axfr_qid, 0x4da8e951, expected_mac)
 
@@ -316,7 +316,7 @@ class TSIGContextTest(unittest.TestCase):
 
         test_qid = 0x7fc4
         tsig = self.createMessageAndSign(test_qid, self.test_name,
-                                         self.tsig_ctx, 0, RRType.SOA())
+                                         self.tsig_ctx, 0, RRType.SOA)
 
         # "advance the clock" and try validating, which should fail due to
         # BADTIME
@@ -328,7 +328,7 @@ class TSIGContextTest(unittest.TestCase):
         # make and sign a response in the context of TSIG error.
         tsig = self.createMessageAndSign(test_qid, self.test_name,
                                          self.tsig_verify_ctx,
-                                         QR_FLAG, RRType.SOA(), None, None,
+                                         QR_FLAG, RRType.SOA, None, None,
                                          True, Rcode.NOTAUTH())
 
         expected_otherdata = b"\x00\x00\x4d\xa8\xbe\x86"
@@ -344,7 +344,7 @@ class TSIGContextTest(unittest.TestCase):
         fix_current_time(0x4da8b9d6)
 
         tsig = self.createMessageAndSign(self.qid, self.test_name,
-                                         self.tsig_ctx, 0, RRType.SOA())
+                                         self.tsig_ctx, 0, RRType.SOA)
 
         # "rewind the clock" and try validating, which should fail due to
         # BADTIME
@@ -361,7 +361,7 @@ class TSIGContextTest(unittest.TestCase):
         fix_current_time(0x4da8b9d6)
 
         tsig = self.createMessageAndSign(self.qid, self.test_name,
-                                         self.tsig_ctx, 0, RRType.SOA())
+                                         self.tsig_ctx, 0, RRType.SOA)
 
         fix_current_time(0x4da8b9d6 + 301)
         self.assertEqual(TSIGError.BAD_TIME,
@@ -382,7 +382,7 @@ class TSIGContextTest(unittest.TestCase):
     def test_badtime_overflow(self):
         fix_current_time(200)
         tsig = self.createMessageAndSign(self.qid, self.test_name,
-                                         self.tsig_ctx, 0, RRType.SOA())
+                                         self.tsig_ctx, 0, RRType.SOA)
 
         # This should be in the okay range, but since "200 - fudge" overflows
         # and we compare them as 64-bit unsigned integers, it results in a
@@ -522,7 +522,7 @@ class TSIGContextTest(unittest.TestCase):
                          self.tsig_verify_ctx.get_state())
         self.createMessageAndSign(self.qid, self.test_name,
                                   self.tsig_verify_ctx,
-                                  QR_FLAG|AA_FLAG|RD_FLAG, RRType.A(),
+                                  QR_FLAG|AA_FLAG|RD_FLAG, RRType.A,
                                   "192.0.2.1")
         self.assertEqual(TSIGContext.STATE_SENT_RESPONSE,
                          self.tsig_verify_ctx.get_state())

+ 29 - 32
src/lib/dns/python/tests/zone_checker_python_test.py

@@ -35,8 +35,8 @@ class ZoneCheckerTest(unittest.TestCase):
         rrsets = RRsetCollection(b'example.org. 0 SOA . . 0 0 0 0 0\n' +
                                  b'example.org. 0 NS ns.example.org.\n' +
                                  b'ns.example.org. 0 A 192.0.2.1\n',
-                                 Name('example.org'), RRClass.IN())
-        self.assertTrue(check_zone(Name('example.org'), RRClass.IN(),
+                                 Name('example.org'), RRClass.IN)
+        self.assertTrue(check_zone(Name('example.org'), RRClass.IN,
                                    rrsets,
                                    (lambda r: self.__callback(r, errors),
                                     lambda r: self.__callback(r, warns))))
@@ -45,8 +45,8 @@ class ZoneCheckerTest(unittest.TestCase):
 
         # Check fails and one additional warning.
         rrsets = RRsetCollection(b'example.org. 0 NS ns.example.org.',
-                                 Name('example.org'), RRClass.IN())
-        self.assertFalse(check_zone(Name('example.org'), RRClass.IN(), rrsets,
+                                 Name('example.org'), RRClass.IN)
+        self.assertFalse(check_zone(Name('example.org'), RRClass.IN, rrsets,
                                     (lambda r: self.__callback(r, errors),
                                      lambda r: self.__callback(r, warns))))
         self.assertEqual(['zone example.org/IN: has 0 SOA records'], errors)
@@ -56,7 +56,7 @@ class ZoneCheckerTest(unittest.TestCase):
         # Same RRset collection, suppressing callbacks
         errors = []
         warns = []
-        self.assertFalse(check_zone(Name('example.org'), RRClass.IN(), rrsets,
+        self.assertFalse(check_zone(Name('example.org'), RRClass.IN, rrsets,
                                     (None, None)))
         self.assertEqual([], errors)
         self.assertEqual([], warns)
@@ -64,29 +64,29 @@ class ZoneCheckerTest(unittest.TestCase):
     def test_check_badarg(self):
         rrsets = RRsetCollection()
         # Bad types
-        self.assertRaises(TypeError, check_zone, 1, RRClass.IN(), rrsets,
+        self.assertRaises(TypeError, check_zone, 1, RRClass.IN, rrsets,
                           (None, None))
         self.assertRaises(TypeError, check_zone, Name('example'), 1, rrsets,
                           (None, None))
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           1, (None, None))
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           rrsets, 1)
 
         # Bad callbacks
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           rrsets, (None, None, None))
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           rrsets, (1, None))
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           rrsets, (None, 1))
 
         # Extra/missing args
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           rrsets, (None, None), 1)
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           rrsets)
-        check_zone(Name('example'), RRClass.IN(), rrsets, (None, None))
+        check_zone(Name('example'), RRClass.IN, rrsets, (None, None))
 
     def test_check_callback_fail(self):
         # Let the call raise a Python exception.  It should be propagated to
@@ -96,7 +96,7 @@ class ZoneCheckerTest(unittest.TestCase):
 
         # Using an empty collection, triggering an error callback.
         self.assertRaises(FakeException, check_zone, Name('example.org'),
-                          RRClass.IN(), RRsetCollection(),
+                          RRClass.IN, RRsetCollection(),
                           (__bad_callback, None))
 
         # An unusual case: the callback is expected to return None, but if it
@@ -108,7 +108,7 @@ class ZoneCheckerTest(unittest.TestCase):
 
         ref_checker = RefChecker()
         orig_refcnt = sys.getrefcount(ref_checker)
-        check_zone(Name('example.org'), RRClass.IN(), RRsetCollection(),
+        check_zone(Name('example.org'), RRClass.IN, RRsetCollection(),
                    (lambda r: __callback(r, ref_checker), None))
         self.assertEqual(orig_refcnt, sys.getrefcount(ref_checker))
 
@@ -132,48 +132,45 @@ class ZoneCheckerTest(unittest.TestCase):
                     raise FakeException('find error')
                 if self.__find_result is not 'use_default':
                     return self.__find_result
-                if rrtype == RRType.SOA():
-                    soa = RRset(Name('example'), RRClass.IN(), rrtype,
-                                RRTTL(0))
-                    soa.add_rdata(Rdata(RRType.SOA(), RRClass.IN(),
+                if rrtype == RRType.SOA:
+                    soa = RRset(Name('example'), RRClass.IN, rrtype, RRTTL(0))
+                    soa.add_rdata(Rdata(RRType.SOA, RRClass.IN,
                                         '. . 0 0 0 0 0'))
                     return soa
-                if rrtype == RRType.NS():
-                    ns = RRset(Name('example'), RRClass.IN(), rrtype,
-                               RRTTL(0))
-                    ns.add_rdata(Rdata(RRType.NS(), RRClass.IN(),
-                                       'example.org'))
+                if rrtype == RRType.NS:
+                    ns = RRset(Name('example'), RRClass.IN, rrtype, RRTTL(0))
+                    ns.add_rdata(Rdata(RRType.NS, RRClass.IN, 'example.org'))
                     return ns
                 return None
 
         # A successful case.  Just checking it works in that case.
         rrsets = FakeRRsetCollection()
-        self.assertTrue(check_zone(Name('example'), RRClass.IN(), rrsets,
+        self.assertTrue(check_zone(Name('example'), RRClass.IN, rrsets,
                                    (None, None)))
 
         # Likewise, normal case but zone check fails.
         rrsets = FakeRRsetCollection(False, None)
-        self.assertFalse(check_zone(Name('example'), RRClass.IN(), rrsets,
+        self.assertFalse(check_zone(Name('example'), RRClass.IN, rrsets,
                                     (None, None)))
 
         # Our find() returns a bad type of result.
         rrsets = FakeRRsetCollection(False, 1)
-        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN(),
+        self.assertRaises(TypeError, check_zone, Name('example'), RRClass.IN,
                           rrsets, (None, None))
 
         # Our find() returns an empty SOA RRset.  C++ zone checker code
         # throws, which results in IscException.
         rrsets = FakeRRsetCollection(False, RRset(Name('example'),
-                                                  RRClass.IN(),
-                                                  RRType.SOA(), RRTTL(0)))
+                                                  RRClass.IN,
+                                                  RRType.SOA, RRTTL(0)))
         self.assertRaises(IscException, check_zone, Name('example'),
-                          RRClass.IN(), rrsets, (None, None))
+                          RRClass.IN, rrsets, (None, None))
 
         # Our find() raises an exception.  That exception is propagated to
         # the top level.
         rrsets = FakeRRsetCollection(True)
         self.assertRaises(FakeException, check_zone, Name('example'),
-                          RRClass.IN(), rrsets, (None, None))
+                          RRClass.IN, rrsets, (None, None))
 
 if __name__ == '__main__':
     unittest.main()