Ejemplo n.º 1
0
 def test_parse_should_succeed(self, line, parsed_dict):
     foo = None
     try:
         p = DnstestParser()
         foo = p.parse_line(line)
     except ParseException:
         # assert will fail, no need to do anything here
         pass
     assert foo == parsed_dict
Ejemplo n.º 2
0
 def test_parse_should_succeed(self, line, parsed_dict):
     foo = None
     try:
         p = DnstestParser()
         foo = p.parse_line(line)
     except ParseException:
         # assert will fail, no need to do anything here
         pass
     assert foo == parsed_dict
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
0
 def test_parse_should_raise_exception(self, line):
     with pytest.raises(ParseException):
         p = DnstestParser()
         p.parse_line(line)
Ejemplo n.º 6
0
 def test_parse_should_raise_exception(self, line):
     with pytest.raises(ParseException):
         p = DnstestParser()
         p.parse_line(line)