Debian Codegraph @

src/globus_sdk/testing/data/flows/validate_run.py

raw
1 from globus_sdk.testing.models import RegisteredResponse, ResponseSet
2
3 from ._common import TWO_HOP_TRANSFER_FLOW_ID
4
5 VALIDATE_RUN_SIMPLE_INPUT_BODY = {"param": "value"}
6
7 VALIDATE_INVALID_SIMPLE_INPUT_BODY = {"foo": "bar"}
8
9 VALIDATE_RUN_SIMPLE_SUCCESS_RESPONSE = {"message": "validation successful"}
10
11 validate_simple_input_request = {
12 "body": VALIDATE_RUN_SIMPLE_INPUT_BODY,
13 }
14
15 validate_invalid_simple_input_request = {
16 "body": VALIDATE_INVALID_SIMPLE_INPUT_BODY,
17 }
18
19
20 RESPONSES = ResponseSet(
21 metadata={
22 "flow_id": TWO_HOP_TRANSFER_FLOW_ID,
23 "request_body": VALIDATE_RUN_SIMPLE_INPUT_BODY,
24 },
25 default=RegisteredResponse(
26 service="flows",
27 path=f"/flows/{TWO_HOP_TRANSFER_FLOW_ID}/validate_run",
28 method="POST",
29 status=200,
30 json=VALIDATE_RUN_SIMPLE_SUCCESS_RESPONSE,
31 ),
32 invalid_input_payload=RegisteredResponse(
33 service="flows",
34 path=f"/flows/{TWO_HOP_TRANSFER_FLOW_ID}/validate_run",
35 method="POST",
36 status=400,
37 json={
38 "error": {
39 "code": "FLOW_INPUT_ERROR",
40 "detail": [
41 {
42 "loc": ["$.bool"],
43 "type": "InvalidActionInput",
44 "msg": "'not-a-boolean' is not of type 'boolean'",
45 }
46 ],
47 "message": "Input failed schema validation with 1 error.",
48 },
49 "debug_id": "00000000-2572-411b-9fa9-c72fbed2b0bb",
50 },
51 ),
52 invalid_token=RegisteredResponse(
53 service="flows",
54 path=f"/flows/{TWO_HOP_TRANSFER_FLOW_ID}/validate_run",
55 method="POST",
56 status=401,
57 json={
58 "error": {
59 "code": "AUTHENTICATION_ERROR",
60 "detail": "Expired or invalid Bearer token",
61 },
62 "debug_id": "00000000-1ca9-477d-9937-a26c9d9384b9",
63 },
64 ),
65 not_a_flow_starter=RegisteredResponse(
66 service="flows",
67 path=f"/flows/{TWO_HOP_TRANSFER_FLOW_ID}/validate_run",
68 method="POST",
69 status=403,
70 json={
71 "error": {
72 "code": "FORBIDDEN",
73 "detail": (
74 "You do not have the necessary permissions to perform this action"
75 " on the flow with id value 00000000-0a9d-4036-a9d7-a77c19515594."
76 " Missing permissions: RUN."
77 ),
78 },
79 "debug_id": "00000000-16c3-4872-8bb5-47db18227cb0",
80 },
81 ),
82 )