| 1 |
import uuid |
| 2 |
|
| 3 |
from globus_sdk.testing.models import RegisteredResponse, ResponseSet |
| 4 |
|
| 5 |
INDEX_ID = str(uuid.uuid4()) |
| 6 |
|
| 7 |
_default_display_name = "Awesome Index of Awesomeness" |
| 8 |
_default_description = "An index so awesome that it simply cannot be described" |
| 9 |
|
| 10 |
RESPONSES = ResponseSet( |
| 11 |
default=RegisteredResponse( |
| 12 |
service="search", |
| 13 |
method="PATCH", |
| 14 |
path=f"/v1/index/{INDEX_ID}", |
| 15 |
json={ |
| 16 |
"@datatype": "GSearchIndex", |
| 17 |
"@version": "2017-09-01", |
| 18 |
"creation_date": "2021-04-05 15:05:18", |
| 19 |
"display_name": _default_display_name, |
| 20 |
"description": _default_description, |
| 21 |
"id": INDEX_ID, |
| 22 |
"is_trial": True, |
| 23 |
"subscription_id": None, |
| 24 |
"max_size_in_mb": 1, |
| 25 |
"num_entries": 0, |
| 26 |
"num_subjects": 0, |
| 27 |
"size_in_mb": 0, |
| 28 |
"status": "open", |
| 29 |
}, |
| 30 |
metadata={"index_id": INDEX_ID, "display_name": _default_display_name}, |
| 31 |
), |
| 32 |
forbidden=RegisteredResponse( |
| 33 |
service="search", |
| 34 |
method="PATCH", |
| 35 |
path=f"/v1/index/{INDEX_ID}", |
| 36 |
status=403, |
| 37 |
json={ |
| 38 |
"@datatype": "GError", |
| 39 |
"@version": "2017-09-01", |
| 40 |
"status": 403, |
| 41 |
"code": "Forbidden.Generic", |
| 42 |
"message": "index_update request denied by service", |
| 43 |
"request_id": "0e73b6a61e53468684f86c7993336a72", |
| 44 |
"error_data": { |
| 45 |
"cause": ( |
| 46 |
"You do not have the proper roles " |
| 47 |
"to perform the index_update operation." |
| 48 |
), |
| 49 |
"recommended_resolution": ( |
| 50 |
"Ensure you are making a call authenticated with " |
| 51 |
"a valid Search token and that you have been granted " |
| 52 |
"the required roles for this operation" |
| 53 |
), |
| 54 |
}, |
| 55 |
}, |
| 56 |
metadata={"index_id": INDEX_ID}, |
| 57 |
), |
| 58 |
) |