pyinfra/test/storage/adapter_mock.py
Matthias Bisping c9bfc767a8 Pull request #32: restructuring: moved test out of module scope
Merge in RR/pyinfra from partial_responses to master

Squashed commit of the following:

commit afd67d87a6349c4b97453a12274c6ccf5e976339
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Tue Apr 26 12:48:12 2022 +0200

    updated test container dockerfile for new location of tests directory

commit 37881da08ebedf0f2d0c6c2b267bdb47818a0da1
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Tue Apr 26 12:45:12 2022 +0200

    restructuring: moved test out  of module scope
2022-04-26 13:12:54 +02:00

31 lines
1.1 KiB
Python

from pyinfra.storage.adapters.adapter import StorageAdapter
from test.storage.client_mock import StorageClientMock
class StorageAdapterMock(StorageAdapter):
def __init__(self, client: StorageClientMock):
assert isinstance(client, StorageClientMock)
super().__init__(client=client)
self.__client = self._StorageAdapter__client
def make_bucket(self, bucket_name):
self.__client.make_bucket(bucket_name)
def has_bucket(self, bucket_name):
return self.__client.has_bucket(bucket_name)
def put_object(self, bucket_name, object_name, data):
return self.__client.put_object(bucket_name, object_name, data)
def get_object(self, bucket_name, object_name):
return self.__client.get_object(bucket_name, object_name)
def get_all_objects(self, bucket_name):
return self.__client.get_all_objects(bucket_name)
def clear_bucket(self, bucket_name):
return self.__client.clear_bucket(bucket_name)
def get_all_object_names(self, bucket_name):
return self.__client.get_all_object_names(bucket_name)