From 7120add95d0c5b8a97af861785ec9fe1cfc7eaee Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Mon, 2 May 2016 15:36:05 +0200 Subject: dos2unix --- project2/proj2_s4498062/dns_tests.py | 78 ++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 34 deletions(-) (limited to 'project2/proj2_s4498062/dns_tests.py') diff --git a/project2/proj2_s4498062/dns_tests.py b/project2/proj2_s4498062/dns_tests.py index 66c04ed..be7da9b 100644 --- a/project2/proj2_s4498062/dns_tests.py +++ b/project2/proj2_s4498062/dns_tests.py @@ -1,34 +1,44 @@ -#!/usr/bin/env python2 - -""" Tests for your DNS resolver and server """ - -portnr = 5353 -server = "localhost" - -class TestResolver(unittest.TestCase): - pass - - -class TestResolverCache(unittest.TestCase): - pass - - -class TestServer(unittest.TestCase): - pass - - -if __name__ == "__main__": - # Parse command line arguments - import argparse - parser = argparse.ArgumentParser(description="HTTP Tests") - parser.add_argument("-s", "--server", type=str, default="localhost") - parser.add_argument("-p", "--port", type=int, default=5001) - args, extra = parser.parse_known_args() - portnr = args.port - server = args.server - - # Pass the extra arguments to unittest - sys.argv[1:] = extra - - # Start test suite - unittest.main() +#!/usr/bin/env python2 +""" Tests for your DNS resolver and server """ + +import sys +import unittest + +PORT = 5353 +SERVER = "localhost" + +class TestResolver(unittest.TestCase): + """Unit tests for the resolver""" + pass + + +class TestResolverCache(unittest.TestCase): + """Unit tests for the resolver cache""" + pass + + +class TestServer(unittest.TestCase): + """Unit tests for the server""" + pass + + +def main(): + """Run the tests""" + # Parse command line arguments + import argparse + parser = argparse.ArgumentParser(description="HTTP Tests") + parser.add_argument("-s", "--server", type=str, default="localhost") + parser.add_argument("-p", "--port", type=int, default=5001) + args, extra = parser.parse_known_args() + PORT = args.port + SERVER = args.server + + # Pass the extra arguments to unittest + sys.argv[1:] = extra + + # Start test suite + unittest.main() + +if __name__ == "__main__": + main() + -- cgit v1.2.3