Changeset View
Changeset View
Standalone View
Standalone View
swh/graphql/tests/functional/test_revision.py
Show All 36 Lines | query_str = """ | ||||
} | } | ||||
name { | name { | ||||
text | text | ||||
} | } | ||||
email { | email { | ||||
text | text | ||||
} | } | ||||
} | } | ||||
date { | |||||
date | date | ||||
seconds | |||||
microseconds | |||||
offset | |||||
} | |||||
type | type | ||||
directory { | directory { | ||||
swhid | swhid | ||||
} | } | ||||
} | } | ||||
} | } | ||||
""" | """ | ||||
data, _ = utils.get_query_response(client, query_str % revision.swhid()) | data, _ = utils.get_query_response(client, query_str % revision.swhid()) | ||||
assert data["revision"] == { | assert data["revision"] == { | ||||
"swhid": str(revision.swhid()), | "swhid": str(revision.swhid()), | ||||
"message": {"text": revision.message.decode()}, | "message": {"text": revision.message.decode()}, | ||||
"author": { | "author": { | ||||
"fullname": {"text": revision.author.fullname.decode()}, | "fullname": {"text": revision.author.fullname.decode()}, | ||||
"name": {"text": revision.author.name.decode()}, | "name": {"text": revision.author.name.decode()}, | ||||
"email": {"text": revision.author.email.decode()}, | "email": {"text": revision.author.email.decode()}, | ||||
}, | }, | ||||
"committer": { | "committer": { | ||||
"fullname": {"text": revision.committer.fullname.decode()}, | "fullname": {"text": revision.committer.fullname.decode()}, | ||||
"name": {"text": revision.committer.name.decode()}, | "name": {"text": revision.committer.name.decode()}, | ||||
"email": {"text": revision.committer.email.decode()}, | "email": {"text": revision.committer.email.decode()}, | ||||
}, | }, | ||||
"date": { | |||||
"date": revision.date.to_datetime().isoformat(), | "date": revision.date.to_datetime().isoformat(), | ||||
"seconds": revision.date.timestamp.seconds, | |||||
"microseconds": revision.date.timestamp.microseconds, | |||||
"offset": int(revision.date.offset_bytes), | |||||
}, | |||||
"type": revision.type.value, | "type": revision.type.value, | ||||
"directory": { | "directory": { | ||||
"swhid": str(CoreSWHID(object_id=revision.directory, object_type="dir")) | "swhid": str(CoreSWHID(object_id=revision.directory, object_type="dir")) | ||||
}, | }, | ||||
} | } | ||||
def test_get_revision_with_invalid_swhid(client): | def test_get_revision_with_invalid_swhid(client): | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |