def test_lambda_delete_exposes_boto3_delete_api(self, monkeypatch): task = LambdaDelete(function_name="test") client = MagicMock() client.delete_function = MagicMock() boto3 = MagicMock(client=client) monkeypatch.setattr("prefect.utilities.aws.boto3", boto3) task.run() client().delete_function.assert_called_once_with(FunctionName="test")
def test_lambda_delete_exposes_boto3_delete_api(self, monkeypatch): task = LambdaDelete(function_name="test") client = MagicMock() client.delete_function = MagicMock() boto3 = MagicMock(client=client) monkeypatch.setattr("prefect.utilities.aws.boto3", boto3) task.run() called_method = client.mock_calls[1] assert called_method[0] == "().delete_function" called_method.assert_called_once_with({"FunctionName": "test"})
def test_creds_are_pulled_from_secret(self, monkeypatch): task = LambdaDelete(function_name="test") client = MagicMock() boto3 = MagicMock(client=client) monkeypatch.setattr("prefect.tasks.aws.lambda_function.boto3", boto3) with set_temporary_config({"cloud.use_local_secrets": True}): with prefect.context(secrets=dict(AWS_CREDENTIALS={ "ACCESS_KEY": "42", "SECRET_ACCESS_KEY": "99" })): task.run() kwargs = client.call_args[1] assert kwargs == { "aws_access_key_id": "42", "aws_secret_access_key": "99" }
def test_initialization(self): task = LambdaDelete(function_name="test")
def test_initialization(self): task = LambdaDelete(function_name="test") assert task.aws_credentials_secret == "AWS_CREDENTIALS"