initial commit
This commit is contained in:
27
tests/test_token.py
Normal file
27
tests/test_token.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import unittest
|
||||
import tempfile
|
||||
from jwcrypto.jwt import JWT, JWTExpired
|
||||
|
||||
from src.jwt_cli.main import main
|
||||
from asyncio.runners import run
|
||||
from pwo import async_test, tmpdir
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import json
|
||||
|
||||
|
||||
class TokenTest(unittest.TestCase):
|
||||
@tmpdir
|
||||
def test_parse_token(self, temp_dir):
|
||||
result = temp_dir / 'output.json'
|
||||
|
||||
with self.assertRaises(JWTExpired) as _:
|
||||
main(['token', 'parse', '-i', 'auth_token.txt',
|
||||
'-o', str(result),
|
||||
'--keys', 'file:jwks.json'])
|
||||
main(['token', 'parse', '-i', 'auth_token.txt',
|
||||
'-o', str(result)])
|
||||
with open(result, 'r') as infile:
|
||||
# print(infile.read())
|
||||
jwt = json.load(infile)
|
||||
json.dump(jwt, sys.stdout, indent=4)
|
Reference in New Issue
Block a user