aboutsummaryrefslogtreecommitdiff
path: root/test/requests/test-website.py
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-04-13 15:33:39 +0300
committerMuriithi Frederick Muriuki2018-04-13 15:33:39 +0300
commit55cc4c63478de9587e282522540334e5375aebf1 (patch)
tree77c058685a6fbe8ea100a52746f3071c19fc51ad /test/requests/test-website.py
parente203523415610fe22f236d082d8bde90e6f4cae8 (diff)
downloadgenenetwork2-55cc4c63478de9587e282522540334e5375aebf1.tar.gz
Use single entry-point for tests
* Remove the run-integration-tests.py, and use the test-website.py as the entry point for all tests. This simplifies running the tests for the site.
Diffstat (limited to 'test/requests/test-website.py')
-rwxr-xr-xtest/requests/test-website.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/requests/test-website.py b/test/requests/test-website.py
index a33fe708..b2e09bc4 100755
--- a/test/requests/test-website.py
+++ b/test/requests/test-website.py
@@ -12,6 +12,15 @@ from main_web_functionality import check_main_web_functionality
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):
@@ -30,6 +39,33 @@ def print_help(args_obj, parser):
def dummy(args_obj, parser):
print("Not implemented yet.")
+def integration_tests(args_obj, parser):
+ gn2_url = args_obj.host
+ es_url = app.config.get("ELASTICSEARCH_HOST")+":"+str(app.config.get("ELASTICSEARCH_PORT"))
+ 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
@@ -64,6 +100,10 @@ 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.")
+
# Navigation tests deactivated since system relies on Javascript
# parser.add_argument("-n", "--navigation", dest="accumulate"
# , action="store_const", const=check_navigation, default=print_help