Commit 6140e32c authored by Eelco van der Wel's avatar Eelco van der Wel :speech_balloon:
Browse files

move gql tests to separate file

parent 1dcfa4da
Pipeline #7722 failed with stage
in 1 minute and 16 seconds
Showing with 0 additions and 117 deletions
+0 -117
......@@ -110,120 +110,3 @@ def test_update_item(api: PodAPI):
assert result["type"] == "Person"
assert result["prop1"] == "Bob"
assert result["prop2"] == 10
def test_graphql_1(api: PodAPI):
query = """
query {
Message {
id
subject
sender {
id
displayName
service
owner {
id
displayName
}
}
}
}
"""
res = api.post("graphql", query).json()
message = res["data"][0]
# check selections
assert message["subject"] == "Hello"
assert message["sender"][0]["displayName"] == "Alice"
assert message["sender"][0]["owner"][0]["displayName"] == "Alice"
# check non-selections
assert "dateCreated" not in message
@pytest.mark.skip(reason="TODO /graphQL should error on out-of-schema values")
def test_graphql_2(api: PodAPI):
query = """
query {
Message {
id
subject
sender {
id
displayName
non_existent_value
}
}
}
"""
try:
api.post("graphql", query)
assert False
except PodError as e:
assert e.status == 400
@pytest.mark.skip(reason="TODO /graphQL should support query aggregate functions")
def test_graphql_3(api: PodAPI):
query = """
query {
count
total
}
"""
try:
api.post("graphql", query)
assert False
except PodError as e:
assert e.status == 400
def test_graphql_4(api: PodAPI):
query = """
query {
Person {
id
displayName
~owner (filter: {service: {eq: "whatsapp"}}) {
id
displayName
service
~sender {
subject
}
}
}
}
"""
res = api.post("graphql", query).json()
# check reverse edges
for p in res["data"]:
if p["~owner"][0]["service"] == "whatsapp":
assert p["~owner"][0]["~sender"][0]["subject"] == "Hello"
return
assert False
@pytest.mark.skip(reason="TODO /graphQL should support query aggregate functions")
def test_graphql_5(api: PodAPI):
query = """
query {
Account (filter: {dateCreated: {gte: 1654784703}}, limit: 10) {
id
displayName
}
count
total
}
"""
res = api.post("graphql", query).json()
# count and total
try:
assert res["count"] == 10 and res["total"] == 103
except:
assert False
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment