diff options
author | 2017-12-23 21:49:35 +0100 | |
---|---|---|
committer | 2017-12-23 21:49:58 +0100 | |
commit | 1100c66ce03a059ebe7ece9734e799b49b3a5a9e (patch) | |
tree | a057e7e7511f6675a9327b79e6919f07c5f89f07 /moon_wrapper/tests/unit_python/api/test_wrapper.py | |
parent | 7a4dfdde6314476ae2a1a1c881ff1e3c430f790e (diff) |
moonv4 cleanup
Change-Id: Icef927f3236d985ac13ff7376f6ce6314b2b39b0
Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'moon_wrapper/tests/unit_python/api/test_wrapper.py')
-rw-r--r-- | moon_wrapper/tests/unit_python/api/test_wrapper.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/moon_wrapper/tests/unit_python/api/test_wrapper.py b/moon_wrapper/tests/unit_python/api/test_wrapper.py new file mode 100644 index 00000000..7e9a7421 --- /dev/null +++ b/moon_wrapper/tests/unit_python/api/test_wrapper.py @@ -0,0 +1,28 @@ +import json + + +def get_json(data): + return json.loads(data.decode("utf-8")) + + +def test_authz_true(context): + import moon_wrapper.server + server = moon_wrapper.server.main() + client = server.app.test_client() + _target = { + 'target': { + "name": context.get('object_name'), + }, + "project_id": context.get('project_id'), + "user_id": context.get('subject_name') + } + authz_data = { + 'rule': context.get('action_name'), + 'target': json.dumps(_target), + 'credentials': 'null'} + req = client.post("/authz", data=json.dumps(authz_data)) + assert req.status_code == 200 + assert req.data + assert isinstance(req.data, bytes) + assert req.data == b"True" + |