aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wqflask/tests/utility/test_hmac.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/wqflask/tests/utility/test_hmac.py b/wqflask/tests/utility/test_hmac.py
index c7927685..16b50771 100644
--- a/wqflask/tests/utility/test_hmac.py
+++ b/wqflask/tests/utility/test_hmac.py
@@ -12,24 +12,28 @@ from utility.hmac import hmac_creation
class TestHmacUtil(unittest.TestCase):
"""Test Utility method for hmac creation"""
+ @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
def test_hmac_creation(self):
"""Test hmac creation with a utf-8 string"""
- self.assertEqual(hmac_creation("ファイ"), "21fa1d935bbbb07a7875")
+ self.assertEqual(hmac_creation("ファイ"), "7410466338cfe109e946")
+ @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
def test_data_hmac(self):
"""Test data_hmac fn with a utf-8 string"""
- self.assertEqual(data_hmac("ファイ"), "ファイ:21fa1d935bbbb07a7875")
+ self.assertEqual(data_hmac("ファイ"), "ファイ:7410466338cfe109e946")
+ @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
@mock.patch("utility.hmac.url_for")
def test_url_for_hmac_with_plain_url(self, mock_url):
"""Test url_for_hmac without params"""
mock_url.return_value = "https://mock_url.com/ファイ/"
self.assertEqual(url_for_hmac("ファイ"),
- "https://mock_url.com/ファイ/?hm=a62896a50d9ffcff7deb")
+ "https://mock_url.com/ファイ/?hm=05bc39e659b1948f41e7")
+ @mock.patch("utility.hmac.app.config", {'SECRET_HMAC_CODE': "secret"})
@mock.patch("utility.hmac.url_for")
def test_url_for_hmac_with_param_in_url(self, mock_url):
"""Test url_for_hmac with params"""
mock_url.return_value = "https://mock_url.com/?ファイ=1"
self.assertEqual(url_for_hmac("ファイ"),
- "https://mock_url.com/?ファイ=1&hm=b2128fb28bc32da3b5b7")
+ "https://mock_url.com/?ファイ=1&hm=4709c1708270644aed79")