|
3 | 3 |
|
4 | 4 | import pytest
|
5 | 5 | import requests
|
| 6 | + |
6 | 7 | import responses
|
| 8 | +from responses import matchers |
| 9 | + |
7 | 10 | from jwkest.jwk import rsa_load, RSAKey
|
8 | 11 | from jwkest.jws import JWS
|
9 | 12 |
|
@@ -46,13 +49,15 @@ def test_existing_account_linking_with_known_known_uuid(self, account_linking_co
|
46 | 49 | }
|
47 | 50 | key = RSAKey(key=rsa_load(account_linking_config["sign_key"]), use="sig", alg="RS256")
|
48 | 51 | jws = JWS(json.dumps(data), alg=key.alg).sign_compact([key])
|
| 52 | + url = "%s/get_id" % account_linking_config["api_url"] |
| 53 | + params = {"jwt": jws} |
49 | 54 | responses.add(
|
50 | 55 | responses.GET,
|
51 |
| - "%s/get_id?jwt=%s" % (account_linking_config["api_url"], jws), |
52 |
| - status=200, |
| 56 | + url=url, |
53 | 57 | body=uuid,
|
| 58 | + match=[matchers.query_param_matcher(params)], |
54 | 59 | content_type="text/html",
|
55 |
| - match_querystring=True |
| 60 | + status=200, |
56 | 61 | )
|
57 | 62 |
|
58 | 63 | self.account_linking.process(context, internal_response)
|
@@ -82,13 +87,15 @@ def test_full_flow(self, account_linking_config, internal_response, context):
|
82 | 87 | uuid = "uuid"
|
83 | 88 | with responses.RequestsMock() as rsps:
|
84 | 89 | # account is linked, 200 OK
|
| 90 | + url = "%s/get_id" % account_linking_config["api_url"] |
| 91 | + params = {"jwt": jws} |
85 | 92 | rsps.add(
|
86 | 93 | responses.GET,
|
87 |
| - "%s/get_id?jwt=%s" % (account_linking_config["api_url"], jws), |
88 |
| - status=200, |
| 94 | + url=url, |
89 | 95 | body=uuid,
|
| 96 | + match=[matchers.query_param_matcher(params)], |
90 | 97 | content_type="text/html",
|
91 |
| - match_querystring=True |
| 98 | + status=200, |
92 | 99 | )
|
93 | 100 | internal_response = self.account_linking._handle_al_response(context)
|
94 | 101 | assert internal_response.subject_id == uuid
|
|
0 commit comments