-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathtest_policies.py
33 lines (28 loc) · 989 Bytes
/
test_policies.py
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
29
30
31
32
33
import pytest
from tests.test_result_msg import add_datahub_stats
@pytest.mark.read_only
def test_policies_are_accessible(auth_session):
json = {
"query": """
query listPolicies($input: ListPoliciesInput!) {
listPolicies(input: $input) {
total
policies {
urn
name
state
}
}
}
""",
"variables": {"input": {"query": "*"}},
}
response = auth_session.post(
f"{auth_session.frontend_url()}/api/v2/graphql", json=json
)
res_json = response.json()
assert res_json, f"Received JSON was {res_json}"
res_data = res_json.get("data", {}).get("listPolicies", {})
assert res_data, f"Received listPolicies were {res_data}"
assert res_data["total"] > 0, f"Total was {res_data['total']}"
add_datahub_stats("num-policies", res_data["total"])