File: test_scope_helpers.py

package info (click to toggle)
python-globus-sdk 4.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,144 kB
  • sloc: python: 35,242; sh: 37; makefile: 35
file content (32 lines) | stat: -rw-r--r-- 1,047 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import uuid

zero_id = uuid.UUID(int=0)
zero_id_s = str(zero_id)


def test_manage_collections_scope_helper(client):
    sc = client.get_gcs_endpoint_scopes(zero_id)
    assert (
        str(sc.manage_collections)
        == f"urn:globus:auth:scope:{zero_id_s}:manage_collections"
    )
    # data_access is separated from endpoint scopes
    assert not hasattr(sc, "data_access")


def test_data_access_scope_helper(client):
    sc = client.get_gcs_collection_scopes(zero_id)
    assert (
        str(sc.data_access) == f"https://auth.globus.org/scopes/{zero_id_s}/data_access"
    )
    assert str(sc.https) == f"https://auth.globus.org/scopes/{zero_id_s}/https"
    # manage_collections is separated from collection scopes
    assert not hasattr(sc, "manage_collections")


def test_contains_scope_properties(client):
    ep_sc = client.get_gcs_endpoint_scopes(zero_id)
    assert ep_sc.manage_collections in list(ep_sc)

    collection_sc = client.get_gcs_collection_scopes(zero_id)
    assert collection_sc.data_access in list(collection_sc)