Example #1
0
 def test_get_grammar(self):
     p = DnstestParser()
     expected = ['add (record|name|entry)? <hostname_or_fqdn> (with ?)(value|address|target)? <hostname_fqdn_or_ip>',
                 'remove (record|name|entry)? <hostname_or_fqdn>',
                 'rename (record|name|entry)? <hostname_or_fqdn> (with ?)(value ?) <value> to <hostname_or_fqdn>',
                 'change (record|name|entry)? <hostname_or_fqdn> to <hostname_fqdn_or_ip>',
                 'confirm (record|name|entry)? <hostname_or_fqdn>',
                 ]
     result = p.get_grammar()
     assert result == expected
 def test_get_grammar(self):
     p = DnstestParser()
     expected = [
         'add (record|name|entry)? <hostname_or_fqdn> (with ?)(value|address|target)? <hostname_fqdn_or_ip>',
         'remove (record|name|entry)? <hostname_or_fqdn>',
         'rename (record|name|entry)? <hostname_or_fqdn> (with ?)(value ?) <value> to <hostname_or_fqdn>',
         'change (record|name|entry)? <hostname_or_fqdn> to <hostname_fqdn_or_ip>',
         'confirm (record|name|entry)? <hostname_or_fqdn>',
     ]
     result = p.get_grammar()
     assert result == expected
Example #3
0
def parse_opts():
    """
    Runs OptionParser and calls main() with the resulting options.
    """
    usage = "%prog [-h|--help] [--version] [-c|--config path_to_config] [-f|--file path_to_test_file] [-V|--verify]"
    usage += "\n\npydnstest %s - <https://github.com/jantman/pydnstest/>" % VERSION
    usage += "\nlicensed under the GNU Affero General Public License - see LICENSE.txt"
    usage += "\nGrammar:\n\n"
    parser = DnstestParser()
    for s in parser.get_grammar():
        usage += "{s}\n".format(s=s)
    p = optparse.OptionParser(usage=usage, version="pydnstest %s" % VERSION)
    p.add_option('-c', '--config', dest='config_file',
                 help='path to config file (default looks for ./dnstest.ini or ~/.dnstest.ini)')

    p.add_option('-f', '--file', dest='testfile',
                 help='path to file listing tests (default reads from STDIN)')

    p.add_option('-V', '--verify', dest='verify', default=False, action='store_true',
                 help='verify changes against PROD server once they\'re live (default False)')

    p.add_option('-s', '--sleep', dest='sleep', action='store', type='float',
                 help='optionally, a decimal number of seconds to sleep between queries')

    p.add_option('-t', '--ignore-ttl', dest='ignorettl', default=False, action='store_true',
                 help='when comparing responses, ignore the TTL value')

    p.add_option('--example-config', dest='exampleconf', default=False, action='store_true',
                 help='print an example configuration file and exit')

    p.add_option('--configprint', dest='configprint', default=False, action='store_true',
                 help='print the current configuration and exit')

    p.add_option('--promptconfig', dest='promptconfig', default=False, action='store_true',
                 help='interactively build a configuration file through a series of prompts')

    options, args = p.parse_args()
    main(options)
Example #4
0
def parse_opts():
    """
    Runs OptionParser and calls main() with the resulting options.
    """
    usage = "%prog [-h|--help] [--version] [-c|--config path_to_config] [-f|--file path_to_test_file] [-V|--verify]"
    usage += "\n\npydnstest %s - <https://github.com/jantman/pydnstest/>" % VERSION
    usage += "\nlicensed under the GNU Affero General Public License - see LICENSE.txt"
    usage += "\nGrammar:\n\n"
    parser = DnstestParser()
    for s in parser.get_grammar():
        usage += "{s}\n".format(s=s)
    p = optparse.OptionParser(usage=usage, version="pydnstest %s" % VERSION)
    p.add_option(
        '-c',
        '--config',
        dest='config_file',
        help=
        'path to config file (default looks for ./dnstest.ini or ~/.dnstest.ini)'
    )

    p.add_option('-f',
                 '--file',
                 dest='testfile',
                 help='path to file listing tests (default reads from STDIN)')

    p.add_option(
        '-V',
        '--verify',
        dest='verify',
        default=False,
        action='store_true',
        help=
        'verify changes against PROD server once they\'re live (default False)'
    )

    p.add_option(
        '-s',
        '--sleep',
        dest='sleep',
        action='store',
        type='float',
        help='optionally, a decimal number of seconds to sleep between queries'
    )

    p.add_option('-t',
                 '--ignore-ttl',
                 dest='ignorettl',
                 default=False,
                 action='store_true',
                 help='when comparing responses, ignore the TTL value')

    p.add_option('--example-config',
                 dest='exampleconf',
                 default=False,
                 action='store_true',
                 help='print an example configuration file and exit')

    p.add_option('--configprint',
                 dest='configprint',
                 default=False,
                 action='store_true',
                 help='print the current configuration and exit')

    p.add_option(
        '--promptconfig',
        dest='promptconfig',
        default=False,
        action='store_true',
        help=
        'interactively build a configuration file through a series of prompts')

    options, args = p.parse_args()
    main(options)