Пример #1
0
def does_object_exist(key: str) -> bool:
    """Tests whether or not an object key exists
    Args:
        key: The object key to check
    Returns:
        True if the object exists, False otherwise
    Raises:
        exceptions.StorageError on any unexpected error interacting with storage
    """
    try:
        return storage.does_object_exist(STORAGE_LOCATION, key)
    except Exception:
        raise exceptions.StorageError(
            "Uncaught exception while performing storage does_object_exist")
Пример #2
0
 def test_does_object_exist_returns_true_when_existing(self, mock_head):
     self.assertTrue(s3.does_object_exist("loc", "key"))
Пример #3
0
 def test_does_object_exist_returns_false_when_head_error(self, mock_head):
     self.assertFalse(s3.does_object_exist("loc", "key"))
Пример #4
0
 def test_does_object_exist_calls_with_correct_params(self, mock_head):
     s3.does_object_exist("loc", "key")
     mock_head.assert_called_once_with(Bucket="loc", Key="key")