diff options
author | zsloan | 2021-02-18 21:36:28 +0000 |
---|---|---|
committer | BonfaceKilz | 2021-02-19 12:59:37 +0300 |
commit | c1d775162c2a657f9e8001914cc216cd70460371 (patch) | |
tree | 7a0574b6bc5b189d17ba58af33de72d3331776a6 /wqflask | |
parent | c4d315831dc1d59841a2ebc30bd073bc8d27476b (diff) | |
download | genenetwork2-c1d775162c2a657f9e8001914cc216cd70460371.tar.gz |
Patched utility.authentication_tools.g as TestUserSession because otherwise the str.encode failed on the mock.Mock() object, and this also seems consistent with the way it's done in a later method
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/tests/unit/utility/test_authentication_tools.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/wqflask/tests/unit/utility/test_authentication_tools.py b/wqflask/tests/unit/utility/test_authentication_tools.py index 5c391be5..6d817f5e 100644 --- a/wqflask/tests/unit/utility/test_authentication_tools.py +++ b/wqflask/tests/unit/utility/test_authentication_tools.py @@ -5,7 +5,6 @@ from unittest import mock from utility.authentication_tools import check_resource_availability from utility.authentication_tools import add_new_resource - class TestResponse: """Mock Test Response after a request""" @property @@ -38,7 +37,7 @@ class TestCheckResourceAvailability(unittest.TestCase): """Test methods related to checking the resource availability""" @mock.patch('utility.authentication_tools.add_new_resource') @mock.patch('utility.authentication_tools.Redis') - @mock.patch('utility.authentication_tools.g', mock.Mock()) + @mock.patch('utility.authentication_tools.g', TestUserSession()) @mock.patch('utility.authentication_tools.get_resource_id') def test_check_resource_availability_default_mask( self, @@ -46,6 +45,7 @@ class TestCheckResourceAvailability(unittest.TestCase): redis_mock, add_new_resource_mock): """Test the resource availability with default mask""" + resource_id_mock.return_value = 1 redis_mock.smembers.return_value = [] test_dataset = mock.MagicMock() @@ -64,7 +64,7 @@ class TestCheckResourceAvailability(unittest.TestCase): redis_mock, add_new_resource_mock, requests_mock): - """Test the resource availability with default mask""" + """Test the resource availability with non-default mask""" resource_id_mock.return_value = 1 redis_mock.smembers.return_value = [] add_new_resource_mock.return_value = {"default_mask": 2} |