def test_delete(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.delete_object.return_value = None
     store.delete(self.user_id,
                  self.uuid,
                  container="anan",
                  path_format=self.path_format)
     self.assertRaises(None)
示例#2
0
 def test_delete(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.delete_object.return_value = None
     store.delete(self.user_id,
                  self.uuid,
                  container="anan",
                  path_format=self.path_format)
     self.assertRaises(None)
示例#3
0
 def test_delete_client_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.delete_object.side_effect = ClientException("delete failed")
     with self.assertRaises(ClientException) as ar:
         store.delete(self.user_id,
                      self.uuid,
                      container="anan",
                      path_format=self.path_format)
     self.assertIsInstance(ar.exception, ClientException)
示例#4
0
 def test_download(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.get_object.return_value = None, "123"
     data = store.download(self.user_id,
                           self.uuid,
                           container="anan",
                           chunk_size=512,
                           path_format=self.path_format)
     self.assertEqual(data, "123")
 def test_delete_client_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.delete_object.side_effect = ClientException("delete failed")
     with self.assertRaises(ClientException) as ar:
         store.delete(self.user_id,
                      self.uuid,
                      container="anan",
                      path_format=self.path_format)
     self.assertIsInstance(ar.exception, ClientException)
 def test_download(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.get_object.return_value = None, "123"
     data = store.download(self.user_id,
                           self.uuid,
                           container="anan",
                           chunk_size=512,
                           path_format=self.path_format)
     self.assertEqual(data, "123")
 def test_upload_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     with self.assertRaises(Exception) as ar:
         store.upload(self.user_id, self.uuid, self.data,
                      container=None,
                      ctype=None,
                      chunk_size=512,
                      path_format=self.path_format)
     self.assertIsInstance(ar.exception, Exception)
示例#8
0
 def test_download_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.get_object.side_effect = ClientException("get failed!")
     with self.assertRaises(ClientException) as ar:
         store.download(self.user_id,
                        self.uuid,
                        container="anan",
                        chunk_size=512,
                        path_format=self.path_format)
     self.assertIsInstance(ar.exception, ClientException)
示例#9
0
 def test_upload(self, mock_swift):
     store = SwiftStore(mock_swift, TIER_1, None)
     container = store.upload(self.user_id,
                              self.uuid,
                              self.data,
                              container=None,
                              ctype="image/jpeg",
                              chunk_size=512,
                              path_format=self.path_format)
     self.assertIsNotNone(container)
示例#10
0
 def test_download_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.get_object.side_effect = ClientException("get failed!")
     with self.assertRaises(ClientException) as ar:
         store.download(self.user_id,
                               self.uuid,
                               container="anan",
                               chunk_size=512,
                               path_format=self.path_format)
     self.assertIsInstance(ar.exception, ClientException)
示例#11
0
 def test_upload_client_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.put_object.side_effect = ClientException("upload failed")
     with self.assertRaises(ClientException) as ar:
         store.upload(self.user_id, self.uuid, self.data,
                      container=None,
                      ctype="image/jpeg",
                      chunk_size=512,
                      path_format=self.path_format)
     self.assertIsInstance(ar.exception, ClientException)
示例#12
0
 def test_upload_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     with self.assertRaises(Exception) as ar:
         store.upload(self.user_id,
                      self.uuid,
                      self.data,
                      container=None,
                      ctype=None,
                      chunk_size=512,
                      path_format=self.path_format)
     self.assertIsInstance(ar.exception, Exception)
示例#13
0
 def test_upload_client_exception(self, mock_swift, mock_logger):
     store = SwiftStore(mock_swift, TIER_1, mock_logger)
     mock_swift.put_object.side_effect = ClientException("upload failed")
     with self.assertRaises(ClientException) as ar:
         store.upload(self.user_id,
                      self.uuid,
                      self.data,
                      container=None,
                      ctype="image/jpeg",
                      chunk_size=512,
                      path_format=self.path_format)
     self.assertIsInstance(ar.exception, ClientException)
示例#14
0
 def test_upload(self, mock_swift):
     store = SwiftStore(mock_swift, TIER_1, None)
     container = store.upload(self.user_id, self.uuid, self.data,
                              container=None, ctype="image/jpeg",
                              chunk_size=512, path_format=self.path_format)
     self.assertIsNotNone(container)