aboutsummaryrefslogtreecommitdiff
path: root/gn2/tests/unit
diff options
context:
space:
mode:
authorMunyoki Kilyungi2024-04-30 10:54:48 +0300
committerBonfaceKilz2024-04-30 13:09:46 +0300
commit9856a8f2f9addce60c231ffa1f28366a5e6dba9a (patch)
treefae2162a279de792e5e5c0a31e64d83dcd49293a /gn2/tests/unit
parent5e54afe8fc7fbe0da42a0d8b477c60599f9b967b (diff)
downloadgenenetwork2-9856a8f2f9addce60c231ffa1f28366a5e6dba9a.tar.gz
Revert "Create constructors for encoding and decoding a token."
This reverts commit e7a3bf22da1b63a01343f2cd30cd13c234fe508c.
Diffstat (limited to 'gn2/tests/unit')
-rw-r--r--gn2/tests/unit/wqflask/oauth2/__init__.py0
-rw-r--r--gn2/tests/unit/wqflask/oauth2/test_tokens.py37
2 files changed, 0 insertions, 37 deletions
diff --git a/gn2/tests/unit/wqflask/oauth2/__init__.py b/gn2/tests/unit/wqflask/oauth2/__init__.py
deleted file mode 100644
index e69de29b..00000000
--- a/gn2/tests/unit/wqflask/oauth2/__init__.py
+++ /dev/null
diff --git a/gn2/tests/unit/wqflask/oauth2/test_tokens.py b/gn2/tests/unit/wqflask/oauth2/test_tokens.py
deleted file mode 100644
index ee527f51..00000000
--- a/gn2/tests/unit/wqflask/oauth2/test_tokens.py
+++ /dev/null
@@ -1,37 +0,0 @@
-"""Test oauth2 jwt tokens"""
-from gn2.wqflask.oauth2.tokens import JWTToken
-
-
-JWT_BEARER_TOKEN = b"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIs\
-ImN0eSI6Impzb24ifQ.eyJpc3MiOiJHTjIiLCJ\
-zdWIiOiIxMjM0IiwiYXVkIjoiR04yIiwiZXhwI\
-joiMTIzNDUifQ.ETSr_7O4ZWLac5l4pinO9Xeb\
-mzTO7xp_LvbgxjnskDc"
-
-
-def test_encode_token():
- """Test encoding a jwt token."""
- token = JWTToken(
- key="secret",
- registered_claims={
- "iss": "GN2",
- "sub": "1234",
- "aud": "GN2",
- "exp": "12345",
- }
- )
- assert token.encode() == JWT_BEARER_TOKEN
- assert token.bearer_token == {
- "Authorization": f"Bearer {JWT_BEARER_TOKEN}"
- }
-
-
-def test_decode_token():
- """Test decoding a jwt token."""
- claims = JWTToken.decode(JWT_BEARER_TOKEN, "secret")
- assert claims == {
- 'iss': 'GN2',
- 'sub': '1234',
- 'aud': 'GN2',
- 'exp': '12345'
- }