| 1 |
import uuid |
| 2 |
|
| 3 |
from responses.matchers import query_param_matcher |
| 4 |
|
| 5 |
from globus_sdk.testing.models import RegisteredResponse, ResponseSet |
| 6 |
|
| 7 |
SCOPE1 = { |
| 8 |
"scope_string": "https://auth.globus.org/scopes/3f33d83f-ec0a-4190-887d-0622e7c4ee9a/manage", # noqa: E501 |
| 9 |
"allows_refresh_token": False, |
| 10 |
"id": str(uuid.uuid1()), |
| 11 |
"advertised": False, |
| 12 |
"required_domains": [], |
| 13 |
"name": "Client manage scope", |
| 14 |
"description": "Manage configuration of this client", |
| 15 |
"client": "3f33d83f-ec0a-4190-887d-0622e7c4ee9a", |
| 16 |
"dependent_scopes": [], |
| 17 |
} |
| 18 |
|
| 19 |
SCOPE2 = { |
| 20 |
"scope_string": "https://auth.globus.org/scopes/dfc9a6d3-3373-4a6d-b0a1-b7026d1559d6/view", # noqa: E501 |
| 21 |
"allows_refresh_token": False, |
| 22 |
"id": str(uuid.uuid1()), |
| 23 |
"advertised": False, |
| 24 |
"required_domains": [], |
| 25 |
"name": "Client view scope", |
| 26 |
"description": "View configuration of this client", |
| 27 |
"client": "dfc9a6d3-3373-4a6d-b0a1-b7026d1559d6", |
| 28 |
"dependent_scopes": [], |
| 29 |
} |
| 30 |
|
| 31 |
RESPONSES = ResponseSet( |
| 32 |
default=RegisteredResponse( |
| 33 |
service="auth", |
| 34 |
path="/v2/api/scopes", |
| 35 |
json={"scopes": [SCOPE1, SCOPE2]}, |
| 36 |
metadata={ |
| 37 |
"scope_ids": [SCOPE1["id"], SCOPE2["id"]], |
| 38 |
}, |
| 39 |
), |
| 40 |
id=RegisteredResponse( |
| 41 |
service="auth", |
| 42 |
path="/v2/api/scopes", |
| 43 |
json={"scopes": [SCOPE1]}, |
| 44 |
match=[query_param_matcher(params={"ids": SCOPE1["id"]})], |
| 45 |
metadata={ |
| 46 |
"scope_id": SCOPE1["id"], |
| 47 |
}, |
| 48 |
), |
| 49 |
string=RegisteredResponse( |
| 50 |
service="auth", |
| 51 |
path="/v2/api/scopes", |
| 52 |
json={"scopes": [SCOPE2]}, |
| 53 |
match=[query_param_matcher(params={"scope_strings": SCOPE2["scope_string"]})], |
| 54 |
metadata={ |
| 55 |
"scope_string": SCOPE2["scope_string"], |
| 56 |
}, |
| 57 |
), |
| 58 |
) |