Debian Codegraph @

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

raw
1 import uuid
2
3 from globus_sdk.testing.models import RegisteredResponse, ResponseSet
4
5 NEW_CREDENTIAL_NAME = str(uuid.uuid4()).replace("-", "")
6
7 CREDENTIAL = {
8 "name": "foo",
9 "id": str(uuid.uuid1()),
10 "created": "2023-10-21T22:46:15.845937+00:00",
11 "client": str(uuid.uuid1()),
12 "secret": "abc123",
13 }
14
15
16 RESPONSES = ResponseSet(
17 default=RegisteredResponse(
18 service="auth",
19 method="POST",
20 path=f"/v2/api/clients/{CREDENTIAL['client']}/credentials",
21 json={"credential": CREDENTIAL},
22 metadata={
23 "credential_id": CREDENTIAL["id"],
24 "client_id": CREDENTIAL["client"],
25 "name": CREDENTIAL["name"],
26 },
27 ),
28 name=RegisteredResponse(
29 service="auth",
30 method="POST",
31 path=f"/v2/api/clients/{CREDENTIAL['client']}/credentials",
32 json={
33 "credential": {
34 **CREDENTIAL,
35 "name": NEW_CREDENTIAL_NAME,
36 }
37 },
38 metadata={
39 "name": NEW_CREDENTIAL_NAME,
40 "client_id": CREDENTIAL["client"],
41 },
42 ),
43 )