From 6276160314c26dd46e9ace3676e3fb611c2fc360 Mon Sep 17 00:00:00 2001 From: Roland Hedberg Date: Tue, 9 Mar 2010 18:57:47 +0100 Subject: [PATCH] Added a test for the only function that wasn't tested. Trying to read info about something that isn't cached raises and Exception just like when dealing with a dictionary --- tests/test_5_cache.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_5_cache.py b/tests/test_5_cache.py index 46dc783..c305f13 100644 --- a/tests/test_5_cache.py +++ b/tests/test_5_cache.py @@ -1,7 +1,7 @@ #!/usr/bin/env python import time - +import py from saml2.cache import Cache from saml2.time_util import in_a_while, str_to_time @@ -18,7 +18,7 @@ class TestClass: self.cache = Cache() - def test_0(self): + def test_set(self): not_on_or_after = str_to_time(in_a_while(days=1)) session_info = SESSION_INFO_PATTERN.copy() session_info["ava"] = {"givenName":["Derek"]} @@ -55,6 +55,7 @@ class TestClass: def test_entities(self): assert _eq(self.cache.entities("1234"), ["abcd", "bcde"]) + py.test.raises(Exception, "self.cache.entities('6666')") def test_remove_info(self): self.cache.reset("1234", "bcde") @@ -65,6 +66,10 @@ class TestClass: assert inactive == ['bcde'] assert _eq(ava.keys(), ["givenName"]) assert ava["givenName"] == ["Derek"] + + def test_active(self): + assert self.cache.active("1234", "bcde") == False + assert self.cache.active("1234", "abcd") def test_subjects(self): assert self.cache.subjects() == ["1234"]