Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
c32163d4
Verified
Commit
c32163d4
authored
1 month ago
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[graphql] more un-prefix tests
parent
3365b122
Pipeline
#7197
passed with stages
in 49 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
GraphQL.hs
test/Test/API/GraphQL.hs
+6
-5
No files found.
test/Test/API/GraphQL.hs
View file @
c32163d4
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE QuasiQuotes #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module
Test.API.GraphQL
(
...
...
@@ -28,7 +29,7 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
withValidLoginA
_sctx_port
"alice"
(
GargPassword
"alice"
)
$
\
_clientEnv
authRes
->
do
liftIO
$
(
authRes
^.
authRes_user_id
)
`
shouldBe
`
(
UnsafeMkUserId
2
)
let
query
=
[
r
|
{ "query": "{ user_infos(user_id: 2) { ui_id, ui_email } }" }
|]
let
expected
=
[
json
|
{
"data":{"user_infos":[{"ui_id":2,"ui_email":"alice@gargan.text"}]}
}
|]
let
expected
=
[
json
|
{
data: {user_infos: [{ui_id: 2, ui_email: "alice@gargan.text" }] }
}
|]
protected
(
authRes
^.
authRes_token
)
"POST"
"/gql"
query
`
shouldRespondWithFragment
`
expected
describe
"get_users"
$
do
...
...
@@ -37,8 +38,8 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
withValidLoginA
_sctx_port
"alice"
(
GargPassword
"alice"
)
$
\
_clientEnv
authRes
->
do
-- epo_api_user is a renamed field, we check if it's correctly un-prefixed
liftIO
$
(
authRes
^.
authRes_tree_id
)
`
shouldBe
`
8
let
query
=
[
r
|
{ "query": "{ users(user_id: 8) { u_username, u_hyperdata { epo_api_user } } }" }
|]
let
expected
=
[
json
|
{
"data":{"users":[{"u_username":"alice","u_hyperdata":{"epo_api_user": null}}]}
}
|]
let
query
=
[
r
|
{ "query": "{ users(user_id: 8) { u_username, u_hyperdata { epo_api_user
, public { pseudo }, private { lang }
} } }" }
|]
let
expected
=
[
json
|
{
data: {users: [{u_username: "alice", u_hyperdata: {epo_api_user: null, public: { pseudo: "pseudo" }, private: { lang: "EN" } } }] }
}
|]
protected
(
authRes
^.
authRes_token
)
"POST"
"/gql"
query
`
shouldRespondWithFragment
`
expected
describe
"nodes"
$
do
...
...
@@ -46,7 +47,7 @@ tests = sequential $ aroundAll withTestDBAndPort $ beforeAllWith dbEnvSetup $ do
withApplication
app
$
do
withValidLogin
port
"gargantua"
(
GargPassword
"secret_key"
)
$
\
_clientEnv
token
->
do
let
query
=
[
r
|
{ "query": "{ nodes(node_id: 2) { node_type } }" }
|]
let
expected
=
[
json
|
{
"data":{"nodes":[{"node_type":"NodeFolderPrivate"
}]}}
|]
let
expected
=
[
json
|
{
data: {nodes: [{node_type: "NodeFolderPrivate"
}]}}
|]
protected
token
"POST"
"/gql"
query
`
shouldRespondWithFragment
`
expected
describe
"check error format"
$
do
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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