Esempio n. 1
0
class CacheInvalidateMixinTests(TestCase):
    """
    Tests for django_cache_manager.mixins.CacheInvalidateMixin
    """

    def setUp(self):
        self.mixin = CacheInvalidateMixin()
        self.mixin.model = Manufacturer()

    @patch('django_cache_manager.models.uuid')
    def test_invalidate_model_cache(self, mock_uuid, mock_model_cache):
        """
        Mixin broadcasts new model cache info when a model is invalidated
        """
        mock_uuid4 = Mock(hex='unique_id')
        mock_uuid.uuid4.return_value = mock_uuid4
        self.mixin.invalidate_model_cache()
        self.assertEquals(mock_model_cache.share_model_cache_info.call_count, 2)
Esempio n. 2
0
 def setUp(self):
     self.mixin = CacheInvalidateMixin()
     self.mixin.model = Manufacturer()