initial commit

This commit is contained in:
2024-06-26 10:26:21 +08:00
parent b31a634606
commit fbac45f94a
27 changed files with 584 additions and 0 deletions

27
tests/test_token.py Normal file
View 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)