Team,
Is there any way to 'inject' a class attribute when a 'static' reference is used for the dependency.
Example:
class Configuration:
_BUCKET_NAME = os.getenv('BUCKET', '')
_USERS_TABLE_NAME = os.getenv('USERS_TABLE', None)
_S3_BUCKET = boto3.client('s3')
_DYNAMO_DB = boto3.resource('dynamodb')
def bucketName(self):
return self._BUCKET_NAME
# other code in the class follows
I would like to have these values overridden in a test spec.
so far i have to 'manually' override these values in the spec:
@inject.params(config=Configuration)
def feature_constructedWithMocks(config=None):
config._BUCKET_NAME = injectedBucketMock
assert injectedBucketMock == config.bucketName()
which would be nice to do 'automagically'.
Team,
Is there any way to 'inject' a class attribute when a 'static' reference is used for the dependency.
Example:
I would like to have these values overridden in a test spec.
so far i have to 'manually' override these values in the spec:
which would be nice to do 'automagically'.