def main(): ''' Entry point for the package defined in setup.py. :returns: 0 when records from zone file correctly resolve against nameserver, 2 when not, 3 on errors. :rtype: int ''' # Parse args args = parse_args(sys.argv[1:]) # Setup basic logging setup_logging(args.verbose, args.quiet) logger.debug('Arguments: %s', args) dnszonetest = DnsZoneTest( args.zonename, args.zonefile, nameserver=args.nameserver, verbose=args.verbose, quiet=args.quiet, no_recursion=args.no_recursion, compare_ttl=args.compare_ttl, compare_ns=args.compare_ns, compare_soa=args.compare_soa, ) dnszonetest.compare() return dnszonetest.errno
def main(): ''' Entry point for the package defined in setup.py. :returns: 0 when records from zone file correctly resolve against nameserver, 2 when not, 3 on errors. :rtype: int ''' # Parse args args = parse_args(sys.argv[1:]) # Setup basic logging setup_logging(args.verbose, args.quiet) logger.debug('Arguments: %s', args) dnszonetest = DnsZoneTest( args.zonename, args.zonefile, nameserver=args.nameserver, protocol=args.protocol, verbose=args.verbose, quiet=args.quiet, no_recursion=args.no_recursion, compare_ttl=args.compare_ttl, compare_ns=args.compare_ns, compare_soa=args.compare_soa, ) dnszonetest.compare() return dnszonetest.errno
def test_get_nameserver_ip_raises_UnableToResolveNameServerException(): ''' test if get_nameserver_ip('non.existing.nameserver') raises UnableToResolveNameServerException ''' dzt = DnsZoneTest('example.com', 'example.com', 'non.existing.nameserver') with pytest.raises(UnableToResolveNameServerException): dzt.get_nameserver_ip()
def test_dzt_get_zone_from_file_raises_NoZoneFileException(): dzt = DnsZoneTest('example.com', '/path/to/non/existing/zone/file') with pytest.raises(NoZoneFileException): dzt.get_zone_from_file()
def dzt_ns(zonefile): ''' DnsZoneTest instance with given nameserver. ''' return DnsZoneTest('example.com', zonefile, 'google-public-dns-a.google.com')
def dzt(zonefile): ''' DnsZoneTest instance with no given nameserver. ''' return DnsZoneTest('example.com', zonefile)