| 1 |
from responses.matchers import query_param_matcher |
| 2 |
|
| 3 |
from globus_sdk.testing.models import RegisteredResponse, ResponseSet |
| 4 |
|
| 5 |
from .._common import ENDPOINT_ID, ENDPOINT_ID_2, ENDPOINT_ID_3, NON_USER_ID, USER_ID |
| 6 |
|
| 7 |
DEFAULT_RESPONSE_DOC = [ |
| 8 |
{ |
| 9 |
"uuid": ENDPOINT_ID, |
| 10 |
"name": "my-endpoint", |
| 11 |
"display_name": "My Endpoint", |
| 12 |
"owner": USER_ID, |
| 13 |
}, |
| 14 |
{ |
| 15 |
"uuid": ENDPOINT_ID_2, |
| 16 |
"name": "my-second-endpoint", |
| 17 |
"display_name": "My Second Endpoint", |
| 18 |
"owner": USER_ID, |
| 19 |
}, |
| 20 |
] |
| 21 |
|
| 22 |
ANY_RESPONSE_DOC = [ |
| 23 |
{ |
| 24 |
"uuid": ENDPOINT_ID, |
| 25 |
"name": "my-endpoint", |
| 26 |
"display_name": "My Endpoint", |
| 27 |
"owner": USER_ID, |
| 28 |
}, |
| 29 |
{ |
| 30 |
"uuid": ENDPOINT_ID_2, |
| 31 |
"name": "my-second-endpoint", |
| 32 |
"display_name": "My Second Endpoint", |
| 33 |
"owner": USER_ID, |
| 34 |
}, |
| 35 |
{ |
| 36 |
"uuid": ENDPOINT_ID_3, |
| 37 |
"name": "public_endpoint", |
| 38 |
"display_name": "Public Endpoint", |
| 39 |
"owner": NON_USER_ID, |
| 40 |
}, |
| 41 |
] |
| 42 |
|
| 43 |
RESPONSES = ResponseSet( |
| 44 |
metadata={ |
| 45 |
"endpoint_id": ENDPOINT_ID, |
| 46 |
"endpoint_id_2": ENDPOINT_ID_2, |
| 47 |
"endpoint_id_3": ENDPOINT_ID_3, |
| 48 |
}, |
| 49 |
default=RegisteredResponse( |
| 50 |
service="compute", |
| 51 |
path="/v2/endpoints", |
| 52 |
method="GET", |
| 53 |
json=DEFAULT_RESPONSE_DOC, |
| 54 |
), |
| 55 |
any=RegisteredResponse( |
| 56 |
service="compute", |
| 57 |
path="/v2/endpoints", |
| 58 |
method="GET", |
| 59 |
json=ANY_RESPONSE_DOC, |
| 60 |
match=[query_param_matcher(params={"role": "any"})], |
| 61 |
), |
| 62 |
) |