aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPjotr Prins2020-07-25 08:24:33 +0100
committerPjotr Prins2020-07-25 08:24:33 +0100
commit9f8beacddb71aac9905c896b9d81caf45b4735a0 (patch)
tree1f3ea2b1bdb6835a6c172b739e6872bf59af6181 /test
parentc249ba2ef7d691227da8864838dfc97db68d4084 (diff)
parentf66da35a09cbb8da13cfb142cbe3ff208404970b (diff)
downloadgenenetwork2-9f8beacddb71aac9905c896b9d81caf45b4735a0.tar.gz
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into testing
Diffstat (limited to 'test')
-rw-r--r--test/__init__.py0
-rw-r--r--test/requests/main_web_functionality.py3
-rw-r--r--test/requests/mapping_tests.py12
-rwxr-xr-xtest/requests/test-website.py11
-rw-r--r--test/unittest/__init__.py0
-rw-r--r--test/unittest/base/__init__.py0
-rw-r--r--test/unittest/base/test_general_object.py21
-rw-r--r--test/unittest/test_registration.py27
8 files changed, 30 insertions, 44 deletions
diff --git a/test/__init__.py b/test/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/__init__.py
diff --git a/test/requests/main_web_functionality.py b/test/requests/main_web_functionality.py
index 7b89b833..d070dab9 100644
--- a/test/requests/main_web_functionality.py
+++ b/test/requests/main_web_functionality.py
@@ -20,8 +20,9 @@ def check_search_page(host):
, search_terms_or=""
, search_terms_and="MEAN=(15 16) LRS=(23 46)")
result = requests.get(host+"/search", params=data)
- found = result.text.find("/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P")
+ found = result.text.find("records are shown below")
assert(found >= 0)
+ assert(result.status_code == 200)
print("OK")
check_traits_page(host, "/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P")
diff --git a/test/requests/mapping_tests.py b/test/requests/mapping_tests.py
index 6de81bfe..5748a2a3 100644
--- a/test/requests/mapping_tests.py
+++ b/test/requests/mapping_tests.py
@@ -15,9 +15,9 @@ def check_R_qtl_tool_selection(host, data):
print("")
print("R/qtl mapping tool selection")
headers = {"Content-Type": "application/x-www-form-urlencoded"}
- page = requests.post(host+"/marker_regression", data=data, headers=headers)
+ page = requests.post(host+"/loading", data=data, headers=headers)
doc = fromstring(page.text)
- form = doc.forms[1]
+ form = doc.forms[0]
assert form.fields["dataset"] == "HC_M2_0606_P"
assert form.fields["value:BXD1"] == "15.034"
@@ -25,9 +25,9 @@ def check_CIM_tool_selection(host, data):
print("")
print("CIM mapping tool selection (using reaper)")
data["method"] = "reaper"
- page = requests.post(host+"/marker_regression", data=data)
+ page = requests.post(host+"/loading", data=data)
doc = fromstring(page.text)
- form = doc.forms[1]
+ form = doc.forms[0]
assert form.fields["dataset"] == "HC_M2_0606_P"
assert form.fields["value:BXD1"] == "15.034"
@@ -37,6 +37,6 @@ def check_mapping(args_obj, parser):
host = args_obj.host
data = load_data_from_file()
- check_pylmm_tool_selection(host, copy.deepcopy(data))
- check_R_qtl_tool_selection(host, copy.deepcopy(data)) ## Why does this fail?
+ # check_pylmm_tool_selection(host, copy.deepcopy(data)) ## Not defined
+ check_R_qtl_tool_selection(host, copy.deepcopy(data))
check_CIM_tool_selection(host, copy.deepcopy(data))
diff --git a/test/requests/test-website.py b/test/requests/test-website.py
index b2e09bc4..74057e7f 100755
--- a/test/requests/test-website.py
+++ b/test/requests/test-website.py
@@ -104,16 +104,7 @@ 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
-# , 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)
diff --git a/test/unittest/__init__.py b/test/unittest/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/unittest/__init__.py
diff --git a/test/unittest/base/__init__.py b/test/unittest/base/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/unittest/base/__init__.py
diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py
new file mode 100644
index 00000000..699cb079
--- /dev/null
+++ b/test/unittest/base/test_general_object.py
@@ -0,0 +1,21 @@
+import unittest
+
+from base.GeneralObject import GeneralObject
+
+
+class TestGeneralObjectTests(unittest.TestCase):
+ """
+ Test the GeneralObject base class
+ """
+
+ def test_object_contents(self):
+ """Test whether base contents are stored properly"""
+ test_obj = GeneralObject("a", "b", "c")
+ self.assertEqual("abc", ''.join(test_obj.contents))
+
+ def test_object_dict(self):
+ """Test whether the base class is printed properly"""
+ test_obj = GeneralObject("a", name="test", value=1)
+ self.assertEqual(str(test_obj), "value = 1\nname = test\n")
+ self.assertEqual(
+ repr(test_obj), "value = 1\nname = test\ncontents = ['a']\n")
diff --git a/test/unittest/test_registration.py b/test/unittest/test_registration.py
deleted file mode 100644
index 98d0cdff..00000000
--- a/test/unittest/test_registration.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# Run test with something like
-#
-# env GN2_PROFILE=~/opt/gn-latest GENENETWORK_FILES=$HOME/gn2_data ./bin/genenetwork2 ./etc/default_settings.py -c ../test/unittest/test_registration.py
-#
-
-import unittest
-import mock.es_double as es
-from wqflask.user_manager import RegisterUser
-
-class TestRegisterUser(unittest.TestCase):
- def setUp(self):
- self.es = es.ESDouble()
-
- def testRegisterUserWithCorrectData(self):
- data = {
- "email_address": "user@example.com"
- , "full_name": "A.N. Other"
- , "organization": "Some Organisation"
- , "password": "testing"
- , "password_confirm": "testing"
- , "es_connection": self.es
- }
- result = RegisterUser(data)
- self.assertEqual(len(result.errors), 0, "Errors were not expected")
-
-if __name__ == "__main__":
- unittest.main()