示例#1
0
    def test_lambda_list_exposes_boto3_list_api(self, monkeypatch):
        task = LambdaList()
        client = MagicMock()
        boto3 = MagicMock(client=client)
        monkeypatch.setattr("prefect.utilities.aws.boto3", boto3)
        task.run()

        called_method = client.mock_calls[1]
        assert called_method[0] == "().list_functions"
        called_method.assert_called_once_with({"FunctionName": "test"})
示例#2
0
    def test_lambda_list_exposes_boto3_list_api(self, monkeypatch):
        task = LambdaList()
        client = MagicMock()
        boto3 = MagicMock(client=client)
        monkeypatch.setattr("prefect.utilities.aws.boto3", boto3)
        task.run()

        client().list_functions.assert_called_once_with(
            MasterRegion="ALL",
            FunctionVersion="ALL",
            MaxItems=50,
        )
示例#3
0
 def test_creds_are_pulled_from_secret(self, monkeypatch):
     task = LambdaList()
     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"
     }
示例#4
0
 def test_initialization(self):
     task = LambdaList()
示例#5
0
 def test_initialization(self):
     task = LambdaList()
     assert task.aws_credentials_secret == "AWS_CREDENTIALS"