aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/utility
diff options
context:
space:
mode:
authorBonfaceKilz2020-10-27 01:18:38 +0300
committerGitHub2020-10-27 01:18:38 +0300
commit37c391bc62e9080effcf83c6ff0056ab8841b7fb (patch)
tree1e794c5616c25e82869314a2f4e91f64c4d40ea9 /wqflask/tests/utility
parent85896707ef1f9e214b45298f6b5b1a9dc37bc839 (diff)
parentb369489e6c075eee3f58bb33e493c901b052b0a1 (diff)
downloadgenenetwork2-37c391bc62e9080effcf83c6ff0056ab8841b7fb.tar.gz
Merge pull request #422 from BonfaceKilz/build/python3-migration
Build/python3 migration
Diffstat (limited to 'wqflask/tests/utility')
-rw-r--r--wqflask/tests/utility/test_authentication_tools.py10
-rw-r--r--wqflask/tests/utility/test_hmac.py2
2 files changed, 4 insertions, 8 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()
diff --git a/wqflask/tests/utility/test_hmac.py b/wqflask/tests/utility/test_hmac.py
index 16b50771..7c61c0a6 100644
--- a/wqflask/tests/utility/test_hmac.py
+++ b/wqflask/tests/utility/test_hmac.py
@@ -2,7 +2,7 @@
"""Test hmac utility functions"""
import unittest
-import mock
+from unittest import mock
from utility.hmac import data_hmac
from utility.hmac import url_for_hmac