diff options
author | zsloan | 2020-10-29 14:35:09 -0500 |
---|---|---|
committer | zsloan | 2020-10-29 14:35:09 -0500 |
commit | 7c1c9e2a519ba662e9f293eea73eb7922b2160e4 (patch) | |
tree | f6d4db465d338c1433bbb126e911062a6c31748b /wqflask/tests/utility/test_authentication_tools.py | |
parent | 5a1f69aa85809768577069ae63d92c9ef6aecc02 (diff) | |
parent | 6e6911b466c2727b16a190d8b714f55d7842d7e2 (diff) | |
download | genenetwork2-7c1c9e2a519ba662e9f293eea73eb7922b2160e4.tar.gz |
Merge branch 'testing' of github.com:genenetwork/genenetwork2 into reaper_bootstrap_fix
Diffstat (limited to 'wqflask/tests/utility/test_authentication_tools.py')
-rw-r--r-- | wqflask/tests/utility/test_authentication_tools.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/wqflask/tests/utility/test_authentication_tools.py b/wqflask/tests/utility/test_authentication_tools.py index 99c74245..5c391be5 100644 --- a/wqflask/tests/utility/test_authentication_tools.py +++ b/wqflask/tests/utility/test_authentication_tools.py @@ -1,6 +1,6 @@ """Tests for authentication tools""" import unittest -import mock +from unittest import mock from utility.authentication_tools import check_resource_availability from utility.authentication_tools import add_new_resource @@ -38,17 +38,15 @@ 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.patch('utility.authentication_tools.g', mock.Mock()) @mock.patch('utility.authentication_tools.get_resource_id') def test_check_resource_availability_default_mask( self, resource_id_mock, - g_mock, redis_mock, add_new_resource_mock): """Test the resource availability with default mask""" resource_id_mock.return_value = 1 - g_mock.return_value = mock.Mock() redis_mock.smembers.return_value = [] test_dataset = mock.MagicMock() type(test_dataset).type = mock.PropertyMock(return_value="Test") @@ -58,18 +56,16 @@ class TestCheckResourceAvailability(unittest.TestCase): @mock.patch('utility.authentication_tools.requests.get') @mock.patch('utility.authentication_tools.add_new_resource') @mock.patch('utility.authentication_tools.Redis') - @mock.patch('utility.authentication_tools.g') + @mock.patch('utility.authentication_tools.g', TestUserSession()) @mock.patch('utility.authentication_tools.get_resource_id') def test_check_resource_availability_non_default_mask( self, resource_id_mock, - g_mock, redis_mock, add_new_resource_mock, requests_mock): """Test the resource availability with default mask""" resource_id_mock.return_value = 1 - g_mock.return_value = mock.Mock() redis_mock.smembers.return_value = [] add_new_resource_mock.return_value = {"default_mask": 2} requests_mock.return_value = TestResponse() |