def test_cache_1(self):
        """
        """
        self.assertRaises(AssertionError, set_cache, ["1"], "hurz_0")
        self.assertRaises(AssertionError, get_cache, ["1"])

        self.assertRaises(AssertionError, set_cache, "12", "hurz_0")

        # set_cache(["1", "2"], u"hurz_1")
        # temp = get_cache(["1", "2"])
        # self.assertEqual(temp, u"hurz_1")

        # delete_cache("1")
        # temp = get_cache(["1", "2"])
        # self.assertEqual(temp, None)

        set_cache(["A", "B", "C"], u"hurz_2")
        temp = get_cache(["A", "B", "C"])
        self.assertEqual(temp, u"hurz_2")

        set_cache(["1", "2", "3", "4"], u"hurz_3")
        set_cache(["1", "2", "3", "5"], u"hurz_4")
        temp = get_cache(["1", "2", "3", "4"])
        self.assertEqual(temp, u"hurz_3")

        temp = get_cache(["1", "2", "3", "5"])
        self.assertEqual(temp, u"hurz_4")

        temp = get_cache(["1", "2", "3"])
        self.assertEqual(temp, {'5': u'hurz_4', '4': u'hurz_3'})
Exemple #2
0
    def test_cache_1(self):
        """
        """
        self.assertRaises(AssertionError, set_cache, ["1"], "hurz_0")
        self.assertRaises(AssertionError, get_cache, ["1"])

        self.assertRaises(AssertionError, set_cache, "12", "hurz_0")

        # set_cache(["1", "2"], u"hurz_1")
        # temp = get_cache(["1", "2"])
        # self.assertEqual(temp, u"hurz_1")

        # delete_cache("1")
        # temp = get_cache(["1", "2"])
        # self.assertEqual(temp, None)

        set_cache(["A", "B", "C"], u"hurz_2")
        temp = get_cache(["A", "B", "C"])
        self.assertEqual(temp, u"hurz_2")

        set_cache(["1", "2", "3", "4"], u"hurz_3")
        set_cache(["1", "2", "3", "5"], u"hurz_4")
        temp = get_cache(["1", "2", "3", "4"])
        self.assertEqual(temp, u"hurz_3")

        temp = get_cache(["1", "2", "3", "5"])
        self.assertEqual(temp, u"hurz_4")

        temp = get_cache(["1", "2", "3"])
        self.assertEqual(temp, {'5': u'hurz_4', '4': u'hurz_3'})
    def test_cache_2(self):
        """
        """
        set_cache([1, "portlets", "left-slot"], u"portlets left")
        set_cache([1, "portlets", "right-slot"], u"portlets right")
        set_cache([1, "children"], ["c1", "c2"])

        self.assertEqual(get_cache(["1", "portlets", "left-slot"]), u"portlets left")
        self.assertEqual(get_cache(["1", "portlets", "right-slot"]), u"portlets right")
        self.assertEqual(get_cache(["1", "children"]), ["c1", "c2"])

        delete_cache("1")
        self.assertEqual(get_cache(["1", "portlets"]), None)
        self.assertEqual(get_cache(["1", "children"]), None)
Exemple #4
0
    def test_cache_2(self):
        """
        """
        set_cache([1, "portlets", "left-slot"], u"portlets left")
        set_cache([1, "portlets", "right-slot"], u"portlets right")
        set_cache([1, "children"], ["c1", "c2"])

        self.assertEqual(get_cache(["1", "portlets", "left-slot"]), u"portlets left")
        self.assertEqual(get_cache(["1", "portlets", "right-slot"]), u"portlets right")
        self.assertEqual(get_cache(["1", "children"]), ["c1", "c2"])

        delete_cache("1")
        self.assertEqual(get_cache(["1", "portlets"]), None)
        self.assertEqual(get_cache(["1", "children"]), None)
 def test_cache_3(self):
     """
     """
     set_cache(["1", "2", "3", "4"], u"hurz_3")
     delete_cache(["1", "2", "3"])
     temp = get_cache(["1", "2"])
     self.assertEqual(temp, {})
Exemple #6
0
 def test_cache_3(self):
     """
     """
     set_cache(["1", "2", "3", "4"], u"hurz_3")
     delete_cache(["1", "2", "3"])
     temp = get_cache(["1", "2"])
     self.assertEqual(temp, {})