File: test_constants.py

package info (click to toggle)
dnspython 2.7.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,448 kB
  • sloc: python: 34,885; sh: 7; makefile: 4
file content (41 lines) | stat: -rw-r--r-- 1,351 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license

import unittest

import dns.dnssec
import dns.edns
import dns.flags
import dns.message
import dns.opcode
import dns.rcode
import dns.rdtypes.dnskeybase
import dns.update
import tests.util


class ConstantsTestCase(unittest.TestCase):
    def test_dnssec_constants(self):
        tests.util.check_enum_exports(
            dns.dnssec, self.assertEqual, only={dns.dnssec.Algorithm}
        )
        tests.util.check_enum_exports(dns.rdtypes.dnskeybase, self.assertEqual)

    def test_flags_constants(self):
        tests.util.check_enum_exports(dns.flags, self.assertEqual)
        tests.util.check_enum_exports(dns.rcode, self.assertEqual)
        tests.util.check_enum_exports(dns.opcode, self.assertEqual)

    def test_message_constants(self):
        tests.util.check_enum_exports(
            dns.message, self.assertEqual, only={dns.message.MessageSection}
        )
        tests.util.check_enum_exports(dns.update, self.assertEqual)

    def test_rdata_constants(self):
        tests.util.check_enum_exports(dns.rdataclass, self.assertEqual)
        tests.util.check_enum_exports(dns.rdatatype, self.assertEqual)

    def test_edns_constants(self):
        tests.util.check_enum_exports(
            dns.edns, self.assertEqual, only={dns.edns.OptionType}
        )