aboutsummaryrefslogtreecommitdiff
path: root/wqflask/tests/utility
diff options
context:
space:
mode:
authorBonfaceKilz2020-09-17 18:07:39 +0300
committerBonfaceKilz2020-09-17 18:07:39 +0300
commitdb73be83f99d1d01879db5666aaf78d7ff372bdd (patch)
tree183c423d843c9bf24bfbf634945896503baefda5 /wqflask/tests/utility
parent6064148eb2b723a308f0d29595a75ab64f47e1e2 (diff)
parent0fd23995fa21c32c2a6005b2fd70b0bd99d13214 (diff)
downloadgenenetwork2-db73be83f99d1d01879db5666aaf78d7ff372bdd.tar.gz
Merge branch 'testing' into build/python3-migration
Diffstat (limited to 'wqflask/tests/utility')
-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")