forked from python-gitlab/python-gitlab
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_graphql.py
More file actions
28 lines (17 loc) · 781 Bytes
/
test_graphql.py
File metadata and controls
28 lines (17 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest
import gitlab
@pytest.fixture
def gl_gql(gitlab_url: str, gitlab_token: str) -> gitlab.GraphQL:
return gitlab.GraphQL(gitlab_url, token=gitlab_token)
@pytest.fixture
def gl_async_gql(gitlab_url: str, gitlab_token: str) -> gitlab.AsyncGraphQL:
return gitlab.AsyncGraphQL(gitlab_url, token=gitlab_token)
def test_query_returns_valid_response(gl_gql: gitlab.GraphQL):
query = "query {currentUser {active}}"
response = gl_gql.execute(query)
assert response["currentUser"]["active"] is True
@pytest.mark.anyio
async def test_async_query_returns_valid_response(gl_async_gql: gitlab.AsyncGraphQL):
query = "query {currentUser {active}}"
response = await gl_async_gql.execute(query)
assert response["currentUser"]["active"] is True