aboutsummaryrefslogtreecommitdiff
path: root/test/requests/test-website.py
diff options
context:
space:
mode:
authorPjotr Prins2018-03-19 10:52:28 +0100
committerGitHub2018-03-19 10:52:28 +0100
commitb359cb0712e9ef923d35524f310d841581d48f30 (patch)
tree3c4cafc0bc0b481490674c807f279b4371130d0c /test/requests/test-website.py
parent2602be69f2869de376d1b9ced6131d880e9476c2 (diff)
parent5ccf077f53c6546bb9258c7116b4b1cf8903375f (diff)
downloadgenenetwork2-b359cb0712e9ef923d35524f310d841581d48f30.tar.gz
Merge pull request #5 from fredmanglis/testing
Testing
Diffstat (limited to 'test/requests/test-website.py')
-rwxr-xr-xtest/requests/test-website.py71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/requests/test-website.py b/test/requests/test-website.py
new file mode 100755
index 00000000..2bef6eb1
--- /dev/null
+++ b/test/requests/test-website.py
@@ -0,0 +1,71 @@
+# Run with something like
+#
+# env GN2_PROFILE=/home/wrk/opt/gn-latest ./bin/genenetwork2 ./etc/default_settings.py -c ../test/requests/test-website.py http://localhost:5003
+#
+# Mostly to pick up the Guix GN2_PROFILE and python modules
+from __future__ import print_function
+import argparse
+from link_checker import check_links
+from mapping_tests import check_mapping
+from main_web_functionality import check_main_web_functionality
+
+print("Mechanical Rob firing up...")
+
+def run_all(args_obj, parser):
+ print("")
+ print("Running all tests.")
+ check_main_web_functionality(args_obj, parser)
+ check_links(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.")
+
+
+desc = """
+This is Mechanical-Rob - an automated web server tester for
+ Genenetwork.org
+"""
+parser = argparse.ArgumentParser(description=desc)
+
+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("-n", "--navigation", dest="accumulate"
+# , action="store_const", const=check_navigation, default=print_help
+# , help="Checks for navigation.")
+
+# parser.add_argument("-s", "--skip-broken", dest="accumulate"
+# , action="store_const", const=dummy, default=print_help
+# , help="Skip tests that are known to be broken.")
+
+args = parser.parse_args()
+# print("The arguments object: ", args)
+
+args.accumulate(args, parser)