Skip to content

Commit 6e99967

Browse files
authored
Merge pull request #8669 from cjwatson/test-cognitoidp-load-resource
test_cognitoidp: Load jwks-public.json using load_resource
2 parents f7887ca + e246312 commit 6e99967

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/test_cognitoidp/test_cognitoidp.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import datetime
33
import hashlib
44
import hmac
5-
import json
65
import os
76
import random
87
import re
@@ -3424,9 +3423,8 @@ def test_user_authentication_flow_mfa_optional(user_pool=None, user_pool_client=
34243423
def test_token_legitimacy():
34253424
conn = boto3.client("cognito-idp", "us-west-2")
34263425

3427-
path = "../../moto/cognitoidp/resources/jwks-public.json"
3428-
with open(os.path.join(os.path.dirname(__file__), path)) as f:
3429-
json_web_key = jwk.RSAKey.import_key(json.loads(f.read())["keys"][0])
3426+
public_key = load_resource(cognitoidp.__name__, "resources/jwks-public.json")
3427+
json_web_key = jwk.RSAKey.import_key(public_key["keys"][0])
34303428

34313429
for auth_flow in ["ADMIN_NO_SRP_AUTH", "ADMIN_USER_PASSWORD_AUTH"]:
34323430
outputs = authentication_flow(conn, auth_flow)

0 commit comments

Comments
 (0)