diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:33 +0000 |
commit | 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 (patch) | |
tree | a4f824bd33cb075dd5aa3eb5a0a94af221bbe83a /testing/web-platform/tests/credential-management/support/fedcm/variable_accounts.py | |
parent | Adding debian version 124.0.1-1. (diff) | |
download | firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.tar.xz firefox-086c044dc34dfc0f74fbe41f4ecb402b2cd34884.zip |
Merging upstream version 125.0.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/credential-management/support/fedcm/variable_accounts.py')
-rw-r--r-- | testing/web-platform/tests/credential-management/support/fedcm/variable_accounts.py | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/testing/web-platform/tests/credential-management/support/fedcm/variable_accounts.py b/testing/web-platform/tests/credential-management/support/fedcm/variable_accounts.py index c9db2c4528..fc4446acc4 100644 --- a/testing/web-platform/tests/credential-management/support/fedcm/variable_accounts.py +++ b/testing/web-platform/tests/credential-management/support/fedcm/variable_accounts.py @@ -1,25 +1,14 @@ import importlib error_checker = importlib.import_module("credential-management.support.fedcm.request-params-check") -def main(request, response): - request_error = error_checker.accountsCheck(request) - if (request_error): - return request_error - - response.headers.set(b"Content-Type", b"application/json") - - if request.cookies.get(b"accounts") != b"1": - return """ -{ - "accounts": [ - ] -} +result_json = """ +{{ + "accounts": [{}] +}} """ - - return """ +one_account = """ { - "accounts": [{ "id": "1234", "given_name": "John", "name": "John Doe", @@ -28,6 +17,33 @@ def main(request, response): "approved_clients": ["123", "456", "789"], "login_hints": ["john_doe"], "hosted_domains": ["idp.example", "example"] - }] + } +""" + + +two_accounts = one_account + """ +, { + "id": "jane_doe", + "given_name": "Jane", + "name": "Jane Doe", + "email": "jane_doe@idp.example", + "picture": "https://idp.example/profile/5678", + "approved_clients": ["123", "abc"] } """ + +def main(request, response): + request_error = error_checker.accountsCheck(request) + if (request_error): + return request_error + + response.headers.set(b"Content-Type", b"application/json") + + if request.cookies.get(b"accounts") == b"1": + return result_json.format(one_account) + if request.cookies.get(b"accounts") == b"2": + return result_json.format(two_accounts) + + return result_json.format("") + + |