Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 5
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)
Esempio n. 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)
Esempio n. 7
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)
Esempio n. 8
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)
Esempio n. 9
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)
Esempio n. 10
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)
Esempio n. 11
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)
Esempio n. 12
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)
Esempio n. 13
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)
Esempio n. 14
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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)
Esempio n. 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)