diff options
Diffstat (limited to 'test/requests/test-website.py')
-rwxr-xr-x | test/requests/test-website.py | 112 |
1 files changed, 59 insertions, 53 deletions
diff --git a/test/requests/test-website.py b/test/requests/test-website.py index d619a7d5..71055fca 100755 --- a/test/requests/test-website.py +++ b/test/requests/test-website.py @@ -14,16 +14,11 @@ import link_checker import sys # Imports for integration tests -from wqflask import app -from test_login_local import TestLoginLocal -from test_login_orcid import TestLoginOrcid -from test_login_github import TestLoginGithub -from test_registration import TestRegistration -from test_forgot_password import TestForgotPassword from unittest import TestSuite, TextTestRunner, TestLoader print("Mechanical Rob firing up...") + def run_all(args_obj, parser): print("") print("Running all tests.") @@ -35,38 +30,20 @@ def run_all(args_obj, parser): check_mapping(args_obj, parser) # TODO: Add other functions as they are created. + def print_help(args_obj, parser): print(parser.format_help()) + def dummy(args_obj, parser): print("Not implemented yet.") -def integration_tests(args_obj, parser): - gn2_url = args_obj.host - run_integration_tests(gn2_url, es_url) def initTest(klass, gn2_url, es_url): loader = TestLoader() methodNames = loader.getTestCaseNames(klass) return [klass(mname, gn2_url, es_url) for mname in methodNames] -def integration_suite(gn2_url, es_url): - test_cases = [ - TestRegistration - , TestLoginLocal - , TestLoginGithub - , TestLoginOrcid - , TestForgotPassword - ] - the_suite = TestSuite() - for case in test_cases: - the_suite.addTests(initTest(case, gn2_url, es_url)) - return the_suite - -def run_integration_tests(gn2_url, es_url): - runner = TextTestRunner() - runner.run(integration_suite(gn2_url, es_url)) - desc = """ This is Mechanical-Rob - an automated web server tester for @@ -76,34 +53,63 @@ parser = argparse.ArgumentParser(description=desc) parser.add_argument("--fail", help="Fail and stop on any error", action="store_true") -parser.add_argument("-d", "--database", metavar="DB", type=str - , default="db_webqtl_s" - , help="Use database (default db_webqtl_s)") - -parser.add_argument("host", metavar="HOST", type=str - , default="http://localhost:5003" - , help="The url to the web server") - -parser.add_argument("-a", "--all", dest="accumulate", action="store_const" - , const=run_all, default=print_help - , help="Runs all tests.") - -parser.add_argument("-l", "--link-checker", dest="accumulate" - , action='store_const', const=check_links, default=print_help - , help="Checks for dead links.") - -parser.add_argument("-f", "--main-functionality", dest="accumulate" - , action='store_const', const=check_main_web_functionality - , default=print_help - , help="Checks for main web functionality.") - -parser.add_argument("-m", "--mapping", dest="accumulate" - , action="store_const", const=check_mapping, default=print_help - , help="Checks for mapping.") +parser.add_argument( + "-d", + "--database", + metavar="DB", + type=str, + default="db_webqtl_s", + help="Use database (default db_webqtl_s)", +) + +parser.add_argument( + "host", + metavar="HOST", + type=str, + default="http://localhost:5003", + help="The url to the web server", +) + +parser.add_argument( + "-a", + "--all", + dest="accumulate", + action="store_const", + const=run_all, + default=print_help, + help="Runs all tests.", +) + +parser.add_argument( + "-l", + "--link-checker", + dest="accumulate", + action="store_const", + const=check_links, + default=print_help, + help="Checks for dead links.", +) + +parser.add_argument( + "-f", + "--main-functionality", + dest="accumulate", + action="store_const", + const=check_main_web_functionality, + default=print_help, + help="Checks for main web functionality.", +) + +parser.add_argument( + "-m", + "--mapping", + dest="accumulate", + action="store_const", + const=check_mapping, + default=print_help, + help="Checks for mapping.", +) -parser.add_argument("-i", "--integration-tests", dest="accumulate" - , action="store_const", const=integration_tests, default=print_help - , help="Runs integration tests.") args = parser.parse_args() |