Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Memri
pymemri
Commits
6140e32c
Commit
6140e32c
authored
3 years ago
by
Eelco van der Wel
Browse files
Options
Download
Email Patches
Plain Diff
move gql tests to separate file
parent
1dcfa4da
Pipeline
#7722
failed with stage
in 1 minute and 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/pod/test_api.py
+0
-117
tests/pod/test_api.py
with
0 additions
and
117 deletions
+0
-117
tests/pod/test_api.py
+
0
-
117
View file @
6140e32c
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets