aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/python_moonutilities/tests/unit_python/test_cache.py
diff options
context:
space:
mode:
authorWuKong <rebirthmonkey@gmail.com>2017-12-23 21:49:35 +0100
committerWuKong <rebirthmonkey@gmail.com>2017-12-23 21:49:58 +0100
commit1100c66ce03a059ebe7ece9734e799b49b3a5a9e (patch)
treea057e7e7511f6675a9327b79e6919f07c5f89f07 /moonv4/python_moonutilities/tests/unit_python/test_cache.py
parent7a4dfdde6314476ae2a1a1c881ff1e3c430f790e (diff)
moonv4 cleanup
Change-Id: Icef927f3236d985ac13ff7376f6ce6314b2b39b0 Signed-off-by: WuKong <rebirthmonkey@gmail.com>
Diffstat (limited to 'moonv4/python_moonutilities/tests/unit_python/test_cache.py')
-rw-r--r--moonv4/python_moonutilities/tests/unit_python/test_cache.py75
1 files changed, 0 insertions, 75 deletions
diff --git a/moonv4/python_moonutilities/tests/unit_python/test_cache.py b/moonv4/python_moonutilities/tests/unit_python/test_cache.py
deleted file mode 100644
index c479395b..00000000
--- a/moonv4/python_moonutilities/tests/unit_python/test_cache.py
+++ /dev/null
@@ -1,75 +0,0 @@
-import pytest
-
-
-def test_authz_request():
- from python_moonutilities import cache
- c = cache.Cache()
- assert isinstance(c.authz_requests, dict)
-
-
-def test_get_subject_success():
- from python_moonutilities import cache
- cache_obj = cache.Cache()
- policy_id = 'policy_id_1'
- name = 'subject_name'
- subject_id = cache_obj.get_subject(policy_id, name)
- assert subject_id is not None
-
-
-def test_get_subject_failure():
- from python_moonutilities import cache
- cache_obj = cache.Cache()
- policy_id = 'policy_id_1'
- name = 'invalid name'
- with pytest.raises(Exception) as exception_info:
- cache_obj.get_subject(policy_id, name)
- assert str(exception_info.value) == '400: Subject Unknown'
-
-
-def test_get_object_success():
- from python_moonutilities import cache
- cache_obj = cache.Cache()
- policy_id = 'policy_id_1'
- name = 'object_name'
- object_id = cache_obj.get_object(policy_id, name)
- assert object_id is not None
-
-
-def test_get_object_failure():
- from python_moonutilities import cache
- cache_obj = cache.Cache()
- policy_id = 'policy_id_1'
- name = 'invalid name'
- with pytest.raises(Exception) as exception_info:
- cache_obj.get_object(policy_id, name)
- assert str(exception_info.value) == '400: Subject Unknown'
-
-
-def test_get_action_success():
- from python_moonutilities import cache
- cache_obj = cache.Cache()
- policy_id = 'policy_id_1'
- name = 'action_name'
- action_id = cache_obj.get_action(policy_id, name)
- assert action_id is not None
-
-
-def test_get_action_failure():
- from python_moonutilities import cache
- cache_obj = cache.Cache()
- policy_id = 'policy_id_1'
- name = 'invalid name'
- with pytest.raises(Exception) as exception_info:
- cache_obj.get_action(policy_id, name)
- assert str(exception_info.value) == '400: Subject Unknown'
-
-
-def test_cache_manager():
- from python_moonutilities import cache
- cache_obj = cache.Cache()
- assert cache_obj.pdp is not None
- assert cache_obj.meta_rules is not None
- assert len(cache_obj.meta_rules) == 2
- assert cache_obj.policies is not None
- assert len(cache_obj.policies) == 2
- assert cache_obj.models is not None \ No newline at end of file