class BaseCacheBackendTestCase(unittest.TestCase):
    def setUp(self):
        self.backend = BaseCacheBackend()

    def test_init(self):
        self.assertEqual(self.backend.TIMEOUT, 31536000)

    @mock.patch('thumbnails.cache_backends.BaseCacheBackend._get')
    def test_get_calls_backend_specific_get(self, mock__get):
        self.backend.get(['hi', 'there'])
        self.backend.get('key')
        mock__get.assert_has_calls([mock.call('hi/there'), mock.call('key')])

    @mock.patch('thumbnails.cache_backends.BaseCacheBackend._set')
    def test_set_calls_backend_specific_set(self, mock__set):
        thumbnail = Thumbnail(['hi', 'there'])
        self.backend.set(thumbnail)
        mock__set.assert_has_calls([mock.call('hi/there', thumbnail)])
예제 #2
0
class BaseCacheBackendTestCase(unittest.TestCase):
    def setUp(self):
        self.backend = BaseCacheBackend()

    def test_init(self):
        self.assertEqual(self.backend.TIMEOUT, 31536000)

    @mock.patch('thumbnails.cache_backends.BaseCacheBackend._get')
    def test_get_calls_backend_specific_get(self, mock__get):
        self.backend.get(['hi', 'there'])
        self.backend.get('key')
        mock__get.assert_has_calls([mock.call('hi/there'), mock.call('key')])

    @mock.patch('thumbnails.cache_backends.BaseCacheBackend._set')
    def test_set_calls_backend_specific_set(self, mock__set):
        thumbnail = Thumbnail(['hi', 'there'], 'jpg')
        self.backend.set(thumbnail)
        mock__set.assert_has_calls([mock.call('hi/there', thumbnail)])
 def setUp(self):
     self.backend = BaseCacheBackend()
예제 #4
0
 def setUp(self):
     self.backend = BaseCacheBackend()