コード例 #1
0
 def test_example_config_to_string(self):
     """ test converting the example config to a string """
     fpath = os.path.abspath("dnstest.ini.example")
     with open(fpath, 'r') as fh:
         expected = fh.read()
     dc = DnstestConfig()
     dc.server_prod = '1.2.3.4'
     dc.server_test = '1.2.3.5'
     dc.default_domain = '.example.com'
     dc.have_reverse_dns = True
     dc.ignore_ttl = False
     dc.sleep = 0.0
     result = dc.to_string()
     assert result == expected
コード例 #2
0
 def test_example_config_to_string(self):
     """ test converting the example config to a string """
     fpath = os.path.abspath("dnstest.ini.example")
     with open(fpath, 'r') as fh:
         expected = fh.read()
     dc = DnstestConfig()
     dc.server_prod = '1.2.3.4'
     dc.server_test = '1.2.3.5'
     dc.default_domain = '.example.com'
     dc.have_reverse_dns = True
     dc.ignore_ttl = False
     dc.sleep = 0.0
     result = dc.to_string()
     assert result == expected
コード例 #3
0
    def setup_verifies(self):
        """
        Sets up test environment for tests of verify methods,
        including redefining resolve_name and lookup_reverse
        to the appropriate methods in this class
        """
        config = DnstestConfig()
        config.server_test = "test"
        config.server_prod = "prod"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name_verify
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse_verify
        return chk
コード例 #4
0
    def setup_verifies(self):
        """
        Sets up test environment for tests of verify methods,
        including redefining resolve_name and lookup_reverse
        to the appropriate methods in this class
        """
        config = DnstestConfig()
        config.server_test = "test"
        config.server_prod = "prod"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name_verify
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse_verify
        return chk
コード例 #5
0
    def setup_checks(self):
        global config
        global chk
        global parser
        config = DnstestConfig()
        config.server_test = "test_server_stub"
        config.server_prod = "prod_server_stub"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True
        pydnstest.config = config

        parser = DnstestParser()
        pydnstest.parser = parser

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse
        pydnstest.chk = chk
        return (parser, chk)
コード例 #6
0
    def setup_checks(self):
        global config
        global chk
        global parser
        config = DnstestConfig()
        config.server_test = "test_server_stub"
        config.server_prod = "prod_server_stub"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True
        pydnstest.config = config

        parser = DnstestParser()
        pydnstest.parser = parser

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse
        pydnstest.chk = chk
        return (parser, chk)
コード例 #7
0
    def setup_checks(self):
        """
        Sets up test environment for tests of check methods,
        including redefining resolve_name and lookup_reverse
        to the appropriate methods in this class
        """
        config = DnstestConfig()
        config.server_test = "test"
        config.server_prod = "prod"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True
        config.ignore_ttl = False

        parser = DnstestParser()
        pydnstest.parser = parser

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse
        return (parser, chk)
コード例 #8
0
    def setup_checks(self):
        """
        Sets up test environment for tests of check methods,
        including redefining resolve_name and lookup_reverse
        to the appropriate methods in this class
        """
        config = DnstestConfig()
        config.server_test = "test"
        config.server_prod = "prod"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True
        config.ignore_ttl = False

        parser = DnstestParser()
        pydnstest.parser = parser

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse
        return (parser, chk)
コード例 #9
0
    def setup_parser_return_unknown_op(self):
        """
        Sets up test environment for tests of check methods,
        including redefining resolve_name and lookup_reverse
        to the appropriate methods in this class
        """
        config = DnstestConfig()
        config.server_test = "test"
        config.server_prod = "prod"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True

        parser = DnstestParser()
        # mock the parser function to just return None
        parser.parse_line = self.parser_return_unknown_op
        pydnstest.parser = parser

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse
        return (parser, chk)
コード例 #10
0
ファイル: dnstest_test.py プロジェクト: jantman/pydnstest
    def setup_parser_return_unknown_op(self):
        """
        Sets up test environment for tests of check methods,
        including redefining resolve_name and lookup_reverse
        to the appropriate methods in this class
        """
        config = DnstestConfig()
        config.server_test = "test"
        config.server_prod = "prod"
        config.default_domain = ".example.com"
        config.have_reverse_dns = True

        parser = DnstestParser()
        # mock the parser function to just return None
        parser.parse_line = self.parser_return_unknown_op
        pydnstest.parser = parser

        chk = DNStestChecks(config)
        # stub
        chk.DNS.resolve_name = self.stub_resolve_name
        # stub
        chk.DNS.lookup_reverse = self.stub_lookup_reverse
        return (parser, chk)