File size: 1,950 Bytes
d8ad0fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import json

import pytest

from tests.e2e.utils import data_fetcher


@pytest.fixture
def parameter_appconfig_freeform_handler_fn_arn(infrastructure: dict) -> str:
    return infrastructure.get("ParameterAppconfigFreeformHandlerArn", "")


@pytest.fixture
def parameter_appconfig_freeform_handler_fn(infrastructure: dict) -> str:
    return infrastructure.get("ParameterAppconfigFreeformHandler", "")


@pytest.fixture
def parameter_appconfig_freeform_value(infrastructure: dict) -> str:
    return infrastructure.get("AppConfigConfigurationValue", "")


@pytest.fixture
def parameter_appconfig_freeform_application(infrastructure: dict) -> str:
    return infrastructure.get("AppConfigApplication", "")


@pytest.fixture
def parameter_appconfig_freeform_environment(infrastructure: dict) -> str:
    return infrastructure.get("AppConfigEnvironment", "")


@pytest.fixture
def parameter_appconfig_freeform_profile(infrastructure: dict) -> str:
    return infrastructure.get("AppConfigProfile", "")


@pytest.mark.xdist_group(name="parameters")
def test_get_parameter_appconfig_freeform(
    parameter_appconfig_freeform_handler_fn_arn: str,
    parameter_appconfig_freeform_value: str,
    parameter_appconfig_freeform_application: str,
    parameter_appconfig_freeform_environment: str,
    parameter_appconfig_freeform_profile: str,
):
    # GIVEN
    payload = json.dumps(
        {
            "name": parameter_appconfig_freeform_profile,
            "environment": parameter_appconfig_freeform_environment,
            "application": parameter_appconfig_freeform_application,
        },
    )
    expected_return = parameter_appconfig_freeform_value

    # WHEN
    parameter_execution, _ = data_fetcher.get_lambda_response(
        lambda_arn=parameter_appconfig_freeform_handler_fn_arn,
        payload=payload,
    )
    parameter_value = parameter_execution["Payload"].read().decode("utf-8")

    assert parameter_value == expected_return