Debian Codegraph @

src/globus_sdk/testing/data/auth/get_identities.py

raw
1 import uuid
2
3 from globus_sdk.testing.models import RegisteredResponse, ResponseSet
4
5 from ._common import UNAUTHORIZED_AUTH_RESPONSE
6
7 _globus_at_globus_data = {
8 "email": None,
9 "id": "46bd0f56-e24f-11e5-a510-131bef46955c",
10 "identity_provider": "7daddf46-70c5-45ee-9f0f-7244fe7c8707",
11 "name": None,
12 "organization": None,
13 "status": "unused",
14 "username": "[email protected]",
15 }
16 _sirosen_at_globus_data = {
17 "email": "[email protected]",
18 "id": "ae341a98-d274-11e5-b888-dbae3a8ba545",
19 "identity_provider": "927d7238-f917-4eb2-9ace-c523fa9ba34e",
20 "name": "Stephen Rosen",
21 "organization": "Globus Team",
22 "status": "used",
23 "username": "[email protected]",
24 }
25 _globus_at_globusid_data = {
26 "email": "[email protected]",
27 "id": str(uuid.UUID(int=1)),
28 "identity_provider": "41143743-f3c8-4d60-bbdb-eeecaba85bd9",
29 "identity_type": "login",
30 "name": "Globus Team",
31 "organization": "University of Chicago",
32 "status": "used",
33 "username": "[email protected]",
34 }
35
36 RESPONSES = ResponseSet(
37 default=RegisteredResponse(
38 service="auth",
39 path="/v2/api/identities",
40 json={"identities": [_globus_at_globus_data]},
41 metadata={
42 "id": _globus_at_globus_data["id"],
43 "username": _globus_at_globus_data["username"],
44 },
45 ),
46 empty=RegisteredResponse(
47 service="auth",
48 path="/v2/api/identities",
49 json={"identities": []},
50 ),
51 multiple=RegisteredResponse(
52 service="auth",
53 path="/v2/api/identities",
54 json={"identities": [_globus_at_globus_data, _sirosen_at_globus_data]},
55 metadata={
56 "ids": [_globus_at_globus_data["id"], _sirosen_at_globus_data["id"]],
57 "usernames": [
58 _globus_at_globus_data["username"],
59 _sirosen_at_globus_data["username"],
60 ],
61 },
62 ),
63 globusid=RegisteredResponse(
64 service="auth",
65 path="/v2/api/identities",
66 json={"identities": [_globus_at_globusid_data]},
67 metadata={
68 "id": _globus_at_globusid_data["id"],
69 "username": _globus_at_globusid_data["username"],
70 "short_username": _globus_at_globusid_data["username"].partition("@")[0],
71 "org": _globus_at_globusid_data["organization"],
72 },
73 ),
74 sirosen=RegisteredResponse(
75 service="auth",
76 path="/v2/api/identities",
77 json={"identities": [_sirosen_at_globus_data]},
78 metadata={
79 "id": _sirosen_at_globus_data["id"],
80 "username": _sirosen_at_globus_data["username"],
81 "org": _sirosen_at_globus_data["organization"],
82 },
83 ),
84 unauthorized=RegisteredResponse(
85 service="auth",
86 path="/v2/api/identities",
87 status=401,
88 json=UNAUTHORIZED_AUTH_RESPONSE.json,
89 metadata={"error_id": UNAUTHORIZED_AUTH_RESPONSE.error_id},
90 ),
91 )