class TestCacheMixin(TestCase):

    def setUp(self):
        super(TestCacheMixin, self).setUp()
        cache.clear()
        self.mixin = CachedManagerMixin()

    def test_mixin_prefixed_returns_none(self):
        assert_equals(None, self.mixin.get_cached('foo', cache_prefix='foo'))

    def test_mixin_prefixed_returns_value(self):
        self.mixin.set_cached('foo', 'bar', cache_prefix='foo')
        assert_equals('bar', self.mixin.get_cached('foo', cache_prefix='foo'))

    def test_mixin_prefixed_set_doesnt_raise(self):
        assert_equals(None, self.mixin.set_cached('foo', 'bar', cache_prefix='foo'))

    def test_flush_prefixed_flush_doesnt_raise(self):
        assert_equals(None, self.mixin.flush_cached('prefix', cache_prefix='foo'))
 def setUp(self):
     super(TestCacheMixin, self).setUp()
     cache.clear()
     self.mixin = CachedManagerMixin()