From b0d2c0981648e00087612e947004e71a755dd193 Mon Sep 17 00:00:00 2001 From: WuKong Date: Fri, 15 Dec 2017 21:11:51 +0100 Subject: moon_utilities configuration.py unit test Change-Id: I1548eb7ce89c11ccacb55bb4614940a9b438b748 Signed-off-by: WuKong --- .../moon_utilities/tests/unit_python/test_cache.py | 62 +--------------------- 1 file changed, 2 insertions(+), 60 deletions(-) (limited to 'moonv4/moon_utilities/tests/unit_python/test_cache.py') diff --git a/moonv4/moon_utilities/tests/unit_python/test_cache.py b/moonv4/moon_utilities/tests/unit_python/test_cache.py index ae4a4a77..3d4f7292 100644 --- a/moonv4/moon_utilities/tests/unit_python/test_cache.py +++ b/moonv4/moon_utilities/tests/unit_python/test_cache.py @@ -1,8 +1,7 @@ import pytest -import mock_cache as data -def test_cache(): +def test_authz_request(): from moon_utilities import cache c = cache.Cache() assert isinstance(c.authz_requests, dict) @@ -73,61 +72,4 @@ def test_cache_manager(): 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 - - -def test_get_subject_success(): - from moon_utilities 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 moon_utilities 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 moon_utilities 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 moon_utilities 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 moon_utilities 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 moon_utilities 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' + assert cache_obj.models is not None \ No newline at end of file -- cgit 1.2.3-korg