Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/tests/functional/test_directory.py
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
def test_get_target_directory(client): | def test_get_target_directory(client): | ||||
# TargetDirectoryNode is returned from snapshotbranch, release | # TargetDirectoryNode is returned from snapshotbranch, release | ||||
# and directory entry nodes. Release node is used for testing here | # and directory entry nodes. Release node is used for testing here | ||||
query_str = """ | query_str = """ | ||||
query getRelease($swhid: SWHID!) { | query getRelease($swhid: SWHID!) { | ||||
release(swhid: $swhid) { | release(swhid: $swhid) { | ||||
swhid | swhid | ||||
target { | target { | ||||
node { | |||||
...on Directory { | ...on Directory { | ||||
swhid | swhid | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
""" | """ | ||||
data, _ = utils.get_query_response( | data, _ = utils.get_query_response( | ||||
client, | client, | ||||
query_str, | query_str, | ||||
swhid="swh:1:rel:ee4d20e80af850cc0f417d25dc5073792c5010d2", | swhid="swh:1:rel:ee4d20e80af850cc0f417d25dc5073792c5010d2", | ||||
) | ) | ||||
assert data["release"]["target"] == { | assert data["release"]["target"]["node"] == { | ||||
"swhid": "swh:1:dir:0505050505050505050505050505050505050505" | "swhid": "swh:1:dir:0505050505050505050505050505050505050505" | ||||
} | } | ||||
def test_get_directory_with_unknown_swhid(client): | def test_get_directory_with_unknown_swhid(client): | ||||
unknown_sha1 = "1" * 40 | unknown_sha1 = "1" * 40 | ||||
query_str = """ | query_str = """ | ||||
query getDirectory($swhid: SWHID!) { | query getDirectory($swhid: SWHID!) { | ||||
Show All 11 Lines |