diff options
Diffstat (limited to 'moonv4/moon_interface/tests/unit_python/api')
-rw-r--r-- | moonv4/moon_interface/tests/unit_python/api/__init__.py | 0 | ||||
-rw-r--r-- | moonv4/moon_interface/tests/unit_python/api/test_authz.py | 23 |
2 files changed, 23 insertions, 0 deletions
diff --git a/moonv4/moon_interface/tests/unit_python/api/__init__.py b/moonv4/moon_interface/tests/unit_python/api/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/moonv4/moon_interface/tests/unit_python/api/__init__.py diff --git a/moonv4/moon_interface/tests/unit_python/api/test_authz.py b/moonv4/moon_interface/tests/unit_python/api/test_authz.py new file mode 100644 index 00000000..a63948f8 --- /dev/null +++ b/moonv4/moon_interface/tests/unit_python/api/test_authz.py @@ -0,0 +1,23 @@ +import json + + +def get_json(data): + return json.loads(data.decode("utf-8")) + + +def test_authz_true(context): + import moon_interface.server + server = moon_interface.server.main() + client = server.app.test_client() + req = client.get("/authz/{p_id}/{s_id}/{o_id}/{a_id}".format( + p_id=context["project_id"], + s_id=context["subject_name"], + o_id=context["object_name"], + a_id=context["action_name"], + )) + assert req.status_code == 200 + data = get_json(req.data) + assert data + assert "result" in data + assert data['result'] == True + |