1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
from __future__ import annotations
import pytest
from globus_sdk import GlobusSDKUsageError
from globus_sdk.testing import load_response
@pytest.mark.parametrize(
"case_name",
(
"name",
"public_client",
"private_client",
"publicly_visible",
"not_publicly_visible",
"redirect_uris",
"links",
"required_idp",
"preselect_idp",
"client_type_confidential_client",
"client_type_public_installed_client",
"client_type_client_identity",
"client_type_resource_server",
"client_type_globus_connect_server",
"client_type_hybrid_confidential_client_resource_server",
"client_type_public_webapp_client",
),
)
def test_create_child_client_args(
auth_client,
case_name: str,
):
meta = load_response(auth_client.create_child_client, case=case_name).metadata
res = auth_client.create_child_client(**meta["args"])
for k, v in meta["response"].items():
assert res["client"][k] == v
def test_links_requirement(auth_client):
"""
Verify that terms_and_conditions and privacy_policy must be used together.
"""
with pytest.raises(GlobusSDKUsageError):
auth_client.create_child_client(
"FOO",
visibility="public",
terms_and_conditions="https://foo.net",
)
with pytest.raises(GlobusSDKUsageError):
auth_client.create_child_client(
"FOO",
visibility="public",
privacy_policy="https://foo.net",
)
def test_public_client_and_client_type_requirement(auth_client):
"""
Verify that exactly one of ``public_client` and ``client_type`` are expected.
"""
# Neither public_client nor client_type
with pytest.raises(GlobusSDKUsageError):
auth_client.create_child_client(
"FOO",
)
# Both public_client and client_type
with pytest.raises(GlobusSDKUsageError):
auth_client.create_child_client(
"FOO",
public_client=True,
client_type="GCS",
)
|