summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/functional/graphql/conftest.py9
-rw-r--r--tests/functional/graphql/test_graphql.py14
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/functional/graphql/conftest.py b/tests/functional/graphql/conftest.py
new file mode 100644
index 0000000..7193ea4
--- /dev/null
+++ b/tests/functional/graphql/conftest.py
@@ -0,0 +1,9 @@
+import pytest
+
+import gitlab
+
+
+@pytest.fixture(scope="session")
+def graphql_gl(gitlab_service):
+ url, private_token = gitlab_service
+ return gitlab.GraphQLGitlab(url, oauth_token=private_token)
diff --git a/tests/functional/graphql/test_graphql.py b/tests/functional/graphql/test_graphql.py
new file mode 100644
index 0000000..6bba059
--- /dev/null
+++ b/tests/functional/graphql/test_graphql.py
@@ -0,0 +1,14 @@
+from gitlab import GraphQLGitlab
+
+
+def test_graphql_query_current_user(graphql_gl: GraphQLGitlab):
+ query = """
+query {
+ currentUser {
+ username
+ }
+}
+"""
+ graphql_gl.enable_debug()
+ result = graphql_gl.execute(query)
+ assert result["user"]["username"] == "root"