Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/tests/functional/test_revision.py
Show First 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | |||||
def test_get_revision_as_target(client): | def test_get_revision_as_target(client): | ||||
# SWHID of a snapshot with revision as target | # SWHID of a snapshot with revision as target | ||||
snapshot_swhid = "swh:1:snp:9e78d7105c5e0f886487511e2a92377b4ee4c32a" | snapshot_swhid = "swh:1:snp:9e78d7105c5e0f886487511e2a92377b4ee4c32a" | ||||
query_str = """ | query_str = """ | ||||
query getSnapshot($swhid: SWHID!) { | query getSnapshot($swhid: SWHID!) { | ||||
snapshot(swhid: $swhid) { | snapshot(swhid: $swhid) { | ||||
branches(first: 1, types: [revision]) { | branches(first: 1, types: [revision]) { | ||||
nodes { | nodes { | ||||
targetType | |||||
target { | target { | ||||
type | |||||
node { | |||||
...on Revision { | ...on Revision { | ||||
swhid | swhid | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | } | ||||
} | |||||
""" | """ | ||||
data, _ = utils.get_query_response(client, query_str, swhid=snapshot_swhid) | data, _ = utils.get_query_response(client, query_str, swhid=snapshot_swhid) | ||||
revision_obj = data["snapshot"]["branches"]["nodes"][0]["target"] | revision_obj = data["snapshot"]["branches"]["nodes"][0]["target"]["node"] | ||||
assert revision_obj == { | assert revision_obj == { | ||||
"swhid": "swh:1:rev:66c7c1cd9673275037140f2abff7b7b11fc9439c" | "swhid": "swh:1:rev:66c7c1cd9673275037140f2abff7b7b11fc9439c" | ||||
} | } | ||||
def test_get_revision_log(client): | def test_get_revision_log(client): | ||||
revision_swhid = get_revisions_with_parents()[0].swhid() | revision_swhid = get_revisions_with_parents()[0].swhid() | ||||
query_str = """ | query_str = """ | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |