| 1 |
from globus_sdk.testing.models import RegisteredResponse, ResponseSet |
| 2 |
|
| 3 |
REGISTERED_API_ID = "9dc867a4-1c6d-46d9-911f-71c2ac67e38c" |
| 4 |
OWNER_URN = "urn:globus:auth:identity:a1234567-1234-1234-1234-123456789abc" |
| 5 |
ADMIN_URN = "urn:globus:auth:identity:b2345678-2345-2345-2345-234567890abc" |
| 6 |
VIEWER_URN = "urn:globus:auth:identity:c3456789-3456-3456-3456-345678901abc" |
| 7 |
|
| 8 |
REGISTERED_API_DOC = { |
| 9 |
"id": REGISTERED_API_ID, |
| 10 |
"name": "test-registered-api", |
| 11 |
"description": "A test registered API for testing purposes", |
| 12 |
"roles": { |
| 13 |
"owners": [OWNER_URN], |
| 14 |
"administrators": [ADMIN_URN], |
| 15 |
"viewers": [VIEWER_URN], |
| 16 |
}, |
| 17 |
"target": { |
| 18 |
"type": "openapi", |
| 19 |
"openapi_version": "3.1", |
| 20 |
"destination": { |
| 21 |
"method": "get", |
| 22 |
"url": "https://example.com/api/v1/resource/{resource_id}", |
| 23 |
}, |
| 24 |
"specification": { |
| 25 |
"summary": "Get Resource", |
| 26 |
"description": "Retrieve a resource by ID", |
| 27 |
"deprecated": False, |
| 28 |
"parameters": [ |
| 29 |
{ |
| 30 |
"name": "resource_id", |
| 31 |
"in": "path", |
| 32 |
"required": True, |
| 33 |
"schema": {"type": "string"}, |
| 34 |
"allowEmptyValue": False, |
| 35 |
"allowReserved": False, |
| 36 |
"deprecated": False, |
| 37 |
} |
| 38 |
], |
| 39 |
"responses": { |
| 40 |
"200": { |
| 41 |
"description": "A resource response", |
| 42 |
"content": { |
| 43 |
"application/json": { |
| 44 |
"schema": {"$ref": "#/components/schemas/ResourceResponse"} |
| 45 |
} |
| 46 |
}, |
| 47 |
} |
| 48 |
}, |
| 49 |
"security": [{"GlobusAuth": ["urn:globus:auth:scope:example.com:all"]}], |
| 50 |
}, |
| 51 |
"transforms": None, |
| 52 |
"components": { |
| 53 |
"schemas": { |
| 54 |
"ResourceResponse": { |
| 55 |
"type": "object", |
| 56 |
"properties": { |
| 57 |
"resource_id": { |
| 58 |
"type": "string", |
| 59 |
"format": "uuid", |
| 60 |
"description": "The resource identifier", |
| 61 |
}, |
| 62 |
"data": { |
| 63 |
"type": "object", |
| 64 |
"description": "The resource data", |
| 65 |
}, |
| 66 |
}, |
| 67 |
"required": ["resource_id", "data"], |
| 68 |
"additionalProperties": False, |
| 69 |
} |
| 70 |
} |
| 71 |
}, |
| 72 |
}, |
| 73 |
"data_templates": { |
| 74 |
"request": { |
| 75 |
"template": { |
| 76 |
"path": {"$T_ref": "$"}, |
| 77 |
} |
| 78 |
}, |
| 79 |
"response": { |
| 80 |
"2XX": { |
| 81 |
"template": {"$T_ref": "$.body"}, |
| 82 |
"type": "success", |
| 83 |
}, |
| 84 |
"default": { |
| 85 |
"template": { |
| 86 |
"cause": {"$T_ref": "$.body"}, |
| 87 |
"exception": "ActionUnableToRun", |
| 88 |
}, |
| 89 |
"type": "failure", |
| 90 |
}, |
| 91 |
}, |
| 92 |
}, |
| 93 |
"state_input_schema": { |
| 94 |
"type": "object", |
| 95 |
"properties": { |
| 96 |
"resource_id": {"type": "string"}, |
| 97 |
}, |
| 98 |
"required": ["resource_id"], |
| 99 |
}, |
| 100 |
"status": "ACTIVE", |
| 101 |
"subscription_id": "4fa609fc-14f6-4c62-acfd-680873d3b6fe", |
| 102 |
"created_timestamp": "2024-01-15T10:30:00+00:00", |
| 103 |
"edited_timestamp": None, |
| 104 |
"updated_timestamp": "2024-03-20T14:45:30+00:00", |
| 105 |
"scheduled_deletion_timestamp": None, |
| 106 |
} |
| 107 |
|
| 108 |
RESPONSES = ResponseSet( |
| 109 |
metadata={ |
| 110 |
"registered_api_id": REGISTERED_API_ID, |
| 111 |
"name": REGISTERED_API_DOC["name"], |
| 112 |
}, |
| 113 |
default=RegisteredResponse( |
| 114 |
service="flows", |
| 115 |
path=f"/registered_apis/{REGISTERED_API_ID}", |
| 116 |
json=REGISTERED_API_DOC, |
| 117 |
), |
| 118 |
) |