Esempio n. 1
0
def does_superkey_exist(key: str) -> bool:
    """Tests whether or not a superkey ('directory') exists
    Args:
        key: The 'directory' 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_superkey_exist(STORAGE_LOCATION, key)
    except Exception:
        raise exceptions.StorageError(
            "Uncaught exception while performing storage does_superkey_exist")
Esempio n. 2
0
 def test_does_superkey_exist_returns_true_with_contents(self, mock_list):
     self.assertTrue(s3.does_superkey_exist("loc", "key"))
Esempio n. 3
0
 def test_does_superkey_exist_returns_false_without_contents(
         self, mock_list):
     self.assertFalse(s3.does_superkey_exist("loc", "key"))
Esempio n. 4
0
 def test_does_superkey_exist_calls_with_correct_params(self, mock_list):
     s3.does_superkey_exist("loc", "key")
     mock_list.assert_called_once_with(Bucket="loc",
                                       Prefix="key",
                                       MaxKeys=1)