diff options
author | zsloan | 2020-11-12 17:20:39 -0600 |
---|---|---|
committer | zsloan | 2020-11-12 17:20:39 -0600 |
commit | 0b47b750549915f2655d3807f5131837ddf8ccc8 (patch) | |
tree | 814173cb4904177e8e125011ae8abce69ef12f04 /wqflask/tests | |
parent | e20d5f41d076659706442a8ab1db93cd65c9cb0f (diff) | |
parent | cd01afec0bbe28bfcd1982cbf03c056a856b1d13 (diff) | |
download | genenetwork2-0b47b750549915f2655d3807f5131837ddf8ccc8.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into feature/corr_table_changes
Diffstat (limited to 'wqflask/tests')
-rw-r--r-- | wqflask/tests/integration/__init__.py (renamed from wqflask/tests/base/__init__.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/integration/test_markdown_routes.py | 21 | ||||
-rw-r--r-- | wqflask/tests/unit/__init__.py (renamed from wqflask/tests/utility/__init__.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/base/__init__.py (renamed from wqflask/tests/wqflask/__init__.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/base/data.py (renamed from wqflask/tests/base/data.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/base/test_data_set.py (renamed from wqflask/tests/base/test_data_set.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/base/test_general_object.py (renamed from wqflask/tests/base/test_general_object.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/base/test_trait.py (renamed from wqflask/tests/base/test_trait.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/base/test_webqtl_case_data.py (renamed from wqflask/tests/base/test_webqtl_case_data.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/utility/__init__.py (renamed from wqflask/tests/wqflask/api/__init__.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/utility/test_authentication_tools.py (renamed from wqflask/tests/utility/test_authentication_tools.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/utility/test_chunks.py (renamed from wqflask/tests/utility/test_chunks.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/utility/test_corestats.py (renamed from wqflask/tests/utility/test_corestats.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/utility/test_corr_result_helpers.py (renamed from wqflask/tests/utility/test_corr_result_helpers.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/utility/test_formatting.py (renamed from wqflask/tests/utility/test_formatting.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/utility/test_hmac.py (renamed from wqflask/tests/utility/test_hmac.py) | 1 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/__init__.py (renamed from wqflask/tests/wqflask/marker_regression/__init__.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/api/__init__.py (renamed from wqflask/tests/wqflask/show_trait/__init__.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/api/test_gen_menu.py (renamed from wqflask/tests/wqflask/api/test_gen_menu.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/marker_regression/__init__.py | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/marker_regression/test_display_mapping_results.py (renamed from wqflask/tests/wqflask/marker_regression/test_display_mapping_results.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/show_trait/__init__.py | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/show_trait/test_export_trait_data.py (renamed from wqflask/tests/wqflask/show_trait/test_export_trait_data.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/test_collect.py (renamed from wqflask/tests/wqflask/test_collect.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/test_markdown_routes.py | 58 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/test_pbkdf2.py (renamed from wqflask/tests/wqflask/test_pbkdf2.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/test_user_login.py (renamed from wqflask/tests/wqflask/test_user_login.py) | 0 | ||||
-rw-r--r-- | wqflask/tests/unit/wqflask/test_user_session.py (renamed from wqflask/tests/wqflask/test_user_session.py) | 0 |
28 files changed, 79 insertions, 1 deletions
diff --git a/wqflask/tests/base/__init__.py b/wqflask/tests/integration/__init__.py index e69de29b..e69de29b 100644 --- a/wqflask/tests/base/__init__.py +++ b/wqflask/tests/integration/__init__.py diff --git a/wqflask/tests/integration/test_markdown_routes.py b/wqflask/tests/integration/test_markdown_routes.py new file mode 100644 index 00000000..5e3e5045 --- /dev/null +++ b/wqflask/tests/integration/test_markdown_routes.py @@ -0,0 +1,21 @@ +"Integration tests for markdown routes" +import unittest + +from bs4 import BeautifulSoup + +from wqflask import app + + +class TestGenMenu(unittest.TestCase): + """Tests for glossary""" + + def setUp(self): + self.app = app.test_client() + + def tearDown(self): + pass + + def test_glossary_page(self): + """Test that the glossary page is rendered properly""" + response = self.app.get('/glossary', follow_redirects=True) + pass diff --git a/wqflask/tests/utility/__init__.py b/wqflask/tests/unit/__init__.py index e69de29b..e69de29b 100644 --- a/wqflask/tests/utility/__init__.py +++ b/wqflask/tests/unit/__init__.py diff --git a/wqflask/tests/wqflask/__init__.py b/wqflask/tests/unit/base/__init__.py index e69de29b..e69de29b 100644 --- a/wqflask/tests/wqflask/__init__.py +++ b/wqflask/tests/unit/base/__init__.py diff --git a/wqflask/tests/base/data.py b/wqflask/tests/unit/base/data.py index 06a5a989..06a5a989 100644 --- a/wqflask/tests/base/data.py +++ b/wqflask/tests/unit/base/data.py diff --git a/wqflask/tests/base/test_data_set.py b/wqflask/tests/unit/base/test_data_set.py index 96563a16..96563a16 100644 --- a/wqflask/tests/base/test_data_set.py +++ b/wqflask/tests/unit/base/test_data_set.py diff --git a/wqflask/tests/base/test_general_object.py b/wqflask/tests/unit/base/test_general_object.py index 00fd3c72..00fd3c72 100644 --- a/wqflask/tests/base/test_general_object.py +++ b/wqflask/tests/unit/base/test_general_object.py diff --git a/wqflask/tests/base/test_trait.py b/wqflask/tests/unit/base/test_trait.py index 826ccefd..826ccefd 100644 --- a/wqflask/tests/base/test_trait.py +++ b/wqflask/tests/unit/base/test_trait.py diff --git a/wqflask/tests/base/test_webqtl_case_data.py b/wqflask/tests/unit/base/test_webqtl_case_data.py index 8e8ba482..8e8ba482 100644 --- a/wqflask/tests/base/test_webqtl_case_data.py +++ b/wqflask/tests/unit/base/test_webqtl_case_data.py diff --git a/wqflask/tests/wqflask/api/__init__.py b/wqflask/tests/unit/utility/__init__.py index e69de29b..e69de29b 100644 --- a/wqflask/tests/wqflask/api/__init__.py +++ b/wqflask/tests/unit/utility/__init__.py diff --git a/wqflask/tests/utility/test_authentication_tools.py b/wqflask/tests/unit/utility/test_authentication_tools.py index 5c391be5..5c391be5 100644 --- a/wqflask/tests/utility/test_authentication_tools.py +++ b/wqflask/tests/unit/utility/test_authentication_tools.py diff --git a/wqflask/tests/utility/test_chunks.py b/wqflask/tests/unit/utility/test_chunks.py index 8d90a1ec..8d90a1ec 100644 --- a/wqflask/tests/utility/test_chunks.py +++ b/wqflask/tests/unit/utility/test_chunks.py diff --git a/wqflask/tests/utility/test_corestats.py b/wqflask/tests/unit/utility/test_corestats.py index cf91a248..cf91a248 100644 --- a/wqflask/tests/utility/test_corestats.py +++ b/wqflask/tests/unit/utility/test_corestats.py diff --git a/wqflask/tests/utility/test_corr_result_helpers.py b/wqflask/tests/unit/utility/test_corr_result_helpers.py index e196fbdf..e196fbdf 100644 --- a/wqflask/tests/utility/test_corr_result_helpers.py +++ b/wqflask/tests/unit/utility/test_corr_result_helpers.py diff --git a/wqflask/tests/utility/test_formatting.py b/wqflask/tests/unit/utility/test_formatting.py index 9d3033d1..9d3033d1 100644 --- a/wqflask/tests/utility/test_formatting.py +++ b/wqflask/tests/unit/utility/test_formatting.py diff --git a/wqflask/tests/utility/test_hmac.py b/wqflask/tests/unit/utility/test_hmac.py index 4e3652f8..13d6261d 100644 --- a/wqflask/tests/utility/test_hmac.py +++ b/wqflask/tests/unit/utility/test_hmac.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """Test hmac utility functions""" import unittest diff --git a/wqflask/tests/wqflask/marker_regression/__init__.py b/wqflask/tests/unit/wqflask/__init__.py index e69de29b..e69de29b 100644 --- a/wqflask/tests/wqflask/marker_regression/__init__.py +++ b/wqflask/tests/unit/wqflask/__init__.py diff --git a/wqflask/tests/wqflask/show_trait/__init__.py b/wqflask/tests/unit/wqflask/api/__init__.py index e69de29b..e69de29b 100644 --- a/wqflask/tests/wqflask/show_trait/__init__.py +++ b/wqflask/tests/unit/wqflask/api/__init__.py diff --git a/wqflask/tests/wqflask/api/test_gen_menu.py b/wqflask/tests/unit/wqflask/api/test_gen_menu.py index 84898bd1..84898bd1 100644 --- a/wqflask/tests/wqflask/api/test_gen_menu.py +++ b/wqflask/tests/unit/wqflask/api/test_gen_menu.py diff --git a/wqflask/tests/unit/wqflask/marker_regression/__init__.py b/wqflask/tests/unit/wqflask/marker_regression/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/wqflask/tests/unit/wqflask/marker_regression/__init__.py diff --git a/wqflask/tests/wqflask/marker_regression/test_display_mapping_results.py b/wqflask/tests/unit/wqflask/marker_regression/test_display_mapping_results.py index 8ae0f09f..8ae0f09f 100644 --- a/wqflask/tests/wqflask/marker_regression/test_display_mapping_results.py +++ b/wqflask/tests/unit/wqflask/marker_regression/test_display_mapping_results.py diff --git a/wqflask/tests/unit/wqflask/show_trait/__init__.py b/wqflask/tests/unit/wqflask/show_trait/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/wqflask/tests/unit/wqflask/show_trait/__init__.py diff --git a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py b/wqflask/tests/unit/wqflask/show_trait/test_export_trait_data.py index 41761944..41761944 100644 --- a/wqflask/tests/wqflask/show_trait/test_export_trait_data.py +++ b/wqflask/tests/unit/wqflask/show_trait/test_export_trait_data.py diff --git a/wqflask/tests/wqflask/test_collect.py b/wqflask/tests/unit/wqflask/test_collect.py index 9a36132d..9a36132d 100644 --- a/wqflask/tests/wqflask/test_collect.py +++ b/wqflask/tests/unit/wqflask/test_collect.py diff --git a/wqflask/tests/unit/wqflask/test_markdown_routes.py b/wqflask/tests/unit/wqflask/test_markdown_routes.py new file mode 100644 index 00000000..3adf63e5 --- /dev/null +++ b/wqflask/tests/unit/wqflask/test_markdown_routes.py @@ -0,0 +1,58 @@ +"""Test functions in markdown utils""" + +import unittest +from unittest import mock + +from wqflask.markdown_routes import render_markdown + + +class MockRequests404: + @property + def status_code(self): + return 404 + +class MockRequests200: + @property + def status_code(self): + return 200 + + @property + def content(self): + return b""" +# Glossary +This is some content + +## Sub-heading +This is another sub-heading + """ + +class TestMarkdownRoutesFunctions(unittest.TestCase): + """Test cases for functions in markdown_routes""" + + @mock.patch('wqflask.markdown_routes.requests.get') + def test_render_markdown_when_fetching_locally(self, requests_mock): + requests_mock.return_value = MockRequests404() + markdown_content = render_markdown("glossary.md") + requests_mock.assert_called_with( + "https://raw.githubusercontent.com" + "/genenetwork/genenetwork2/" + "wqflask/wqflask/static/" + "glossary.md") + self.assertRegexpMatches(markdown_content, + "Glossary of Terms and Features") + + @mock.patch('wqflask.markdown_routes.requests.get') + def test_render_markdown_when_fetching_remotely(self, requests_mock): + requests_mock.return_value = MockRequests200() + markdown_content = render_markdown("glossary.md") + requests_mock.assert_called_with( + "https://raw.githubusercontent.com" + "/genenetwork/genenetwork2/" + "wqflask/wqflask/static/" + "glossary.md") + self.assertEqual("""<h1>Glossary</h1> +<p>This is some content</p> +<h2>Sub-heading</h2> +<p>This is another sub-heading</p> +""", + markdown_content) diff --git a/wqflask/tests/wqflask/test_pbkdf2.py b/wqflask/tests/unit/wqflask/test_pbkdf2.py index a33fbd4f..a33fbd4f 100644 --- a/wqflask/tests/wqflask/test_pbkdf2.py +++ b/wqflask/tests/unit/wqflask/test_pbkdf2.py diff --git a/wqflask/tests/wqflask/test_user_login.py b/wqflask/tests/unit/wqflask/test_user_login.py index 61cd9ab9..61cd9ab9 100644 --- a/wqflask/tests/wqflask/test_user_login.py +++ b/wqflask/tests/unit/wqflask/test_user_login.py diff --git a/wqflask/tests/wqflask/test_user_session.py b/wqflask/tests/unit/wqflask/test_user_session.py index ebb0334a..ebb0334a 100644 --- a/wqflask/tests/wqflask/test_user_session.py +++ b/wqflask/tests/unit/wqflask/test_user_session.py |