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:
parent
c97393f690
commit
a7ffaeb18f
@ -62,4 +62,4 @@ class AzureStorageAdapter(StorageAdapter):
|
|||||||
def get_all_object_names(self, bucket_name):
|
def get_all_object_names(self, bucket_name):
|
||||||
container_client = self.__provide_container_client(bucket_name)
|
container_client = self.__provide_container_client(bucket_name)
|
||||||
blobs = container_client.list_blobs()
|
blobs = container_client.list_blobs()
|
||||||
return zip(repeat(bucket_name), map(attrgetter("name"), blobs))
|
return map(attrgetter("name"), blobs)
|
||||||
|
|||||||
@ -52,4 +52,4 @@ class S3StorageAdapter(StorageAdapter):
|
|||||||
|
|
||||||
def get_all_object_names(self, bucket_name):
|
def get_all_object_names(self, bucket_name):
|
||||||
objs = self.__client.list_objects(bucket_name, recursive=True)
|
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)
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
from itertools import repeat
|
|
||||||
|
|
||||||
|
|
||||||
class StorageClientMock:
|
class StorageClientMock:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.__data = {}
|
self.__data = {}
|
||||||
@ -24,4 +21,4 @@ class StorageClientMock:
|
|||||||
self.__data[bucket_name] = {}
|
self.__data[bucket_name] = {}
|
||||||
|
|
||||||
def get_all_object_names(self, bucket_name):
|
def get_all_object_names(self, bucket_name):
|
||||||
return zip(repeat(bucket_name), self.__data[bucket_name])
|
return self.__data[bucket_name]
|
||||||
|
|||||||
@ -41,4 +41,4 @@ class TestStorage:
|
|||||||
storage.put_object(bucket_name, "file1", b"content 1")
|
storage.put_object(bucket_name, "file1", b"content 1")
|
||||||
storage.put_object(bucket_name, "file2", b"content 2")
|
storage.put_object(bucket_name, "file2", b"content 2")
|
||||||
full_names_received = storage.get_all_object_names(bucket_name)
|
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}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user