From 0872f8c462ba632eafa05dcb6b56edff8368f6ea Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 14 Jul 2020 14:22:14 +0300 Subject: Remove stale comments --- test/requests/test-website.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'test') 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) -- cgit v1.2.3 From d9bd69a8bd2e92d4aac078d936917929f2e5ca8e Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 16 Jul 2020 16:14:50 +0300 Subject: Check for specific text in response and then assert a 200 code "/show_trait?trait_id=1435395_s_at&dataset=HC_M2_0606_P" is missing in the response code. At one point the html structure changed. --- test/requests/main_web_functionality.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test') 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") -- cgit v1.2.3 From 704294fae6ea6a744006451eb1672dbb1645ff53 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 16 Jul 2020 16:17:01 +0300 Subject: Replace mapping endpoint to "/loading" At one point, "/marker_regression" got replaced, and the html structure changed. --- test/requests/mapping_tests.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test') 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)) -- cgit v1.2.3 From 82929468a0769766cc874b18dbbf5acaa15bc6fc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Thu, 16 Jul 2020 17:32:13 +0300 Subject: Remove unused test --- test/unittest/test_registration.py | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 test/unittest/test_registration.py (limited to 'test') 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() -- cgit v1.2.3 From 64c0c61ee3842ea63921ebb73827333d91cf99cc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 17 Jul 2020 02:47:31 +0300 Subject: Add basic unittests --- test/unittest/__init__.py | 0 test/unittest/base/__init__.py | 0 test/unittest/base/test_data_set.py | 8 ++++++++ test/unittest/base/test_general_object.py | 21 +++++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 test/unittest/__init__.py create mode 100644 test/unittest/base/__init__.py create mode 100644 test/unittest/base/test_data_set.py create mode 100644 test/unittest/base/test_general_object.py (limited to 'test') diff --git a/test/unittest/__init__.py b/test/unittest/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/unittest/base/__init__.py b/test/unittest/base/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/unittest/base/test_data_set.py b/test/unittest/base/test_data_set.py new file mode 100644 index 00000000..6537efa6 --- /dev/null +++ b/test/unittest/base/test_data_set.py @@ -0,0 +1,8 @@ +import unittest + +import wqflask.base.data_set +print dir() + +class TestDataSet(unittest.TestCase): + def test_add(self): + self.assertEqual(3, 4) diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py new file mode 100644 index 00000000..eaefdec9 --- /dev/null +++ b/test/unittest/base/test_general_object.py @@ -0,0 +1,21 @@ +import unittest + +from wqflask.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") -- cgit v1.2.3 From 244761531dd6f4f019add26d837b6b79530e0f17 Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 21 Jul 2020 12:42:52 +0300 Subject: Make test file a module * test/__init__.py: Add it. Makes the test folder discoverable by unittest --- test/__init__.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/__init__.py (limited to 'test') diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 00000000..e69de29b -- cgit v1.2.3 From 3d6483e8fd59d2e77149aa5d78ec32448be7338c Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Tue, 21 Jul 2020 22:46:49 +0300 Subject: Move tests to module * test/unittest/: Move to wqflask/tests/ --- test/unittest/__init__.py | 0 test/unittest/base/__init__.py | 0 test/unittest/base/test_data_set.py | 8 -------- test/unittest/base/test_general_object.py | 21 --------------------- wqflask/tests/__init__.py | 0 wqflask/tests/base/__init__.py | 0 wqflask/tests/base/test_general_object.py | 21 +++++++++++++++++++++ 7 files changed, 21 insertions(+), 29 deletions(-) delete mode 100644 test/unittest/__init__.py delete mode 100644 test/unittest/base/__init__.py delete mode 100644 test/unittest/base/test_data_set.py delete mode 100644 test/unittest/base/test_general_object.py create mode 100644 wqflask/tests/__init__.py create mode 100644 wqflask/tests/base/__init__.py create mode 100644 wqflask/tests/base/test_general_object.py (limited to 'test') diff --git a/test/unittest/__init__.py b/test/unittest/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unittest/base/__init__.py b/test/unittest/base/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/test/unittest/base/test_data_set.py b/test/unittest/base/test_data_set.py deleted file mode 100644 index 6537efa6..00000000 --- a/test/unittest/base/test_data_set.py +++ /dev/null @@ -1,8 +0,0 @@ -import unittest - -import wqflask.base.data_set -print dir() - -class TestDataSet(unittest.TestCase): - def test_add(self): - self.assertEqual(3, 4) diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py deleted file mode 100644 index eaefdec9..00000000 --- a/test/unittest/base/test_general_object.py +++ /dev/null @@ -1,21 +0,0 @@ -import unittest - -from wqflask.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/wqflask/tests/__init__.py b/wqflask/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/tests/base/__init__.py b/wqflask/tests/base/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/wqflask/tests/base/test_general_object.py b/wqflask/tests/base/test_general_object.py new file mode 100644 index 00000000..699cb079 --- /dev/null +++ b/wqflask/tests/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") -- cgit v1.2.3 From 8e3756b8b8094c5d025da31c54c1d0d95a55b0dc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Fri, 17 Jul 2020 02:47:31 +0300 Subject: Add basic unittests --- test/unittest/__init__.py | 0 test/unittest/base/__init__.py | 0 test/unittest/base/test_general_object.py | 21 +++++++++++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 test/unittest/__init__.py create mode 100644 test/unittest/base/__init__.py create mode 100644 test/unittest/base/test_general_object.py (limited to 'test') diff --git a/test/unittest/__init__.py b/test/unittest/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/unittest/base/__init__.py b/test/unittest/base/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py new file mode 100644 index 00000000..eaefdec9 --- /dev/null +++ b/test/unittest/base/test_general_object.py @@ -0,0 +1,21 @@ +import unittest + +from wqflask.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") -- cgit v1.2.3 From 5eb26c5a209f3a3c54cf6fe623e5372188bdd1bc Mon Sep 17 00:00:00 2001 From: BonfaceKilz Date: Sat, 25 Jul 2020 00:59:46 +0300 Subject: Update import statement in test_general_object.py * test/unittest/base/test_general_object.py: replace the import statement to use the module path instead of the path referenced from PYTHONPATH --- test/unittest/base/test_general_object.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/unittest/base/test_general_object.py b/test/unittest/base/test_general_object.py index eaefdec9..699cb079 100644 --- a/test/unittest/base/test_general_object.py +++ b/test/unittest/base/test_general_object.py @@ -1,6 +1,6 @@ import unittest -from wqflask.base.GeneralObject import GeneralObject +from base.GeneralObject import GeneralObject class TestGeneralObjectTests(unittest.TestCase): -- cgit v1.2.3