Example #1
0
 def test_upload_timeout_error(self, mock_redis):
     mock_queue = Mock(spec=HashQueue)
     store = RedisStore(mock_redis, TIER_0, mock_queue, True, None)
     store.queue.enqueue.side_effect = TimeoutError
     with self.assertRaises(TimeoutError) as ar:
         store.upload(self.user_id, self.uuid, self.data)
     self.assertIsInstance(ar.exception, TimeoutError)
Example #2
0
 def test_download_key_error(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     k = data = None
     with self.assertRaises(ValueError) as ar:
         k, data = store.download(None, self.uuid)
     self.assertIsNone(k)
     self.assertIsNone(data)
     self.assertIsInstance(ar.exception, ValueError)
Example #3
0
 def test_delete_key_error(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     len = total_len = -1
     with self.assertRaises(ValueError) as ar:
         len, total_len = store.delete(None, self.uuid)
     self.assertEqual(-1, len)
     self.assertEqual(-1, total_len)
     self.assertIsInstance(ar.exception, ValueError)
Example #4
0
 def test_delete_timeout_error(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     store.queue.release.side_effect = TimeoutError
     len = total_len = -1
     with self.assertRaises(TimeoutError) as ar:
         len, total_len = store.delete(self.user_id, self.uuid)
     self.assertEqual(-1, len)
     self.assertEqual(-1, total_len)
     self.assertIsInstance(ar.exception, TimeoutError)
 def test_upload(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     store.queue.enqueue.return_value = None
     r = store.upload(self.user_id, self.uuid, self.data)
     self.assertIsNone(r)
Example #6
0
 def test_download_timeout_error(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     store.queue.dequeue.side_effect = TimeoutError
     k = data = None
     with self.assertRaises(TimeoutError) as ar:
         k, data = store.download(self.user_id, self.uuid)
     self.assertIsNone(k)
     self.assertIsNone(data)
     self.assertIsInstance(ar.exception, TimeoutError)
 def test_delete(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     store.queue.release.return_value = 10, 20
     user_len, total_len = store.delete(self.user_id, self.uuid)
     self.assertEqual(10, user_len)
     self.assertEqual(20, total_len)
 def test_download(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     store.queue.dequeue.return_value = self.uuid, self.data
     k, data = store.download(self.user_id, self.uuid)
     self.assertEqual(data, self.data)
     self.assertEqual(k, self.uuid)
 def test_upload_key_error(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     store.queue.enqueue.return_value= ValueError
     with self.assertRaises(ValueError) as ar:
         store.upload(None, self.uuid, self.data)
     self.assertIsInstance(ar.exception, ValueError)
 def test_upload_timeout_error(self, mock_redis):
     mock_queue = Mock(spec=HashQueue)
     store = RedisStore(mock_redis,
                        TIER_0,
                        mock_queue,
                        True,
                        None)
     store.queue.enqueue.side_effect = TimeoutError
     with self.assertRaises(TimeoutError) as ar:
         store.upload(self.user_id, self.uuid, self.data)
     self.assertIsInstance(ar.exception, TimeoutError)
 def test_download_key_error(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     k = data = None
     with self.assertRaises(ValueError) as ar:
         k, data = store.download(None, self.uuid)
     self.assertIsNone(k)
     self.assertIsNone(data)
     self.assertIsInstance(ar.exception, ValueError)
 def test_delete_key_error(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     len = total_len = -1
     with self.assertRaises(ValueError) as ar:
         len, total_len = store.delete(None, self.uuid)
     self.assertEqual(-1, len)
     self.assertEqual(-1, total_len)
     self.assertIsInstance(ar.exception, ValueError)
 def test_delete_timeout_error(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     store.queue.release.side_effect = TimeoutError
     len = total_len = -1
     with self.assertRaises(TimeoutError) as ar:
         len, total_len = store.delete(self.user_id, self.uuid)
     self.assertEqual(-1, len)
     self.assertEqual(-1, total_len)
     self.assertIsInstance(ar.exception, TimeoutError)
 def test_download_timeout_error(self, mock_redis):
     store = RedisStore(mock_redis,
                        TIER_0,
                        self.queue_cls,
                        True,
                        None)
     store.queue.dequeue.side_effect = TimeoutError
     k = data = None
     with self.assertRaises(TimeoutError) as ar:
         k, data = store.download(self.user_id, self.uuid)
     self.assertIsNone(k)
     self.assertIsNone(data)
     self.assertIsInstance(ar.exception, TimeoutError)
Example #15
0
 def test_delete(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     store.queue.release.return_value = 10, 20
     user_len, total_len = store.delete(self.user_id, self.uuid)
     self.assertEqual(10, user_len)
     self.assertEqual(20, total_len)
Example #16
0
 def test_download(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     store.queue.dequeue.return_value = self.uuid, self.data
     k, data = store.download(self.user_id, self.uuid)
     self.assertEqual(data, self.data)
     self.assertEqual(k, self.uuid)
Example #17
0
 def test_upload(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     store.queue.enqueue.return_value = None
     r = store.upload(self.user_id, self.uuid, self.data)
     self.assertIsNone(r)
Example #18
0
 def test_upload_key_error(self, mock_redis):
     store = RedisStore(mock_redis, TIER_0, self.queue_cls, True, None)
     store.queue.enqueue.return_value = ValueError
     with self.assertRaises(ValueError) as ar:
         store.upload(None, self.uuid, self.data)
     self.assertIsInstance(ar.exception, ValueError)