changed return value of file name listing function for storages to return strings of filenames rather than tuples of bucket name and file name

This commit is contained in:
Matthias Bisping 2022-05-23 10:19:02 +02:00
parent c97393f690
commit a7ffaeb18f
4 changed files with 4 additions and 7 deletions

View File

@ -62,4 +62,4 @@ class AzureStorageAdapter(StorageAdapter):
def get_all_object_names(self, bucket_name):
container_client = self.__provide_container_client(bucket_name)
blobs = container_client.list_blobs()
return zip(repeat(bucket_name), map(attrgetter("name"), blobs))
return map(attrgetter("name"), blobs)

View File

@ -52,4 +52,4 @@ class S3StorageAdapter(StorageAdapter):
def get_all_object_names(self, bucket_name):
objs = self.__client.list_objects(bucket_name, recursive=True)
return zip(repeat(bucket_name), map(attrgetter("object_name"), objs))
return map(attrgetter("object_name"), objs)

View File

@ -1,6 +1,3 @@
from itertools import repeat
class StorageClientMock:
def __init__(self):
self.__data = {}
@ -24,4 +21,4 @@ class StorageClientMock:
self.__data[bucket_name] = {}
def get_all_object_names(self, bucket_name):
return zip(repeat(bucket_name), self.__data[bucket_name])
return self.__data[bucket_name]

View File

@ -41,4 +41,4 @@ class TestStorage:
storage.put_object(bucket_name, "file1", b"content 1")
storage.put_object(bucket_name, "file2", b"content 2")
full_names_received = storage.get_all_object_names(bucket_name)
assert {(bucket_name, "file1"), (bucket_name, "file2")} == {*full_names_received}
assert {"file1", "file2"} == {*full_names_received}