How to use the pycfmodel.model.resources.properties.statement_condition.StatementCondition function in pycfmodel

To help you get started, we’ve selected a few pycfmodel examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
            StatementCondition(ForAllValuesBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAllValuesBinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAllValuesBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAllValuesBinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAnyValueBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAnyValueBinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAnyValueBinaryEqualsIfExists={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAnyValueBinaryEqualsIfExists",
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
def test_statement_condition_remove_colon():
    assert StatementCondition.parse_obj(
        {
            "ForAllValues:ArnEqualsIfExists": {"patata_1": "test_1"},
            "ForAnyValue:ARNEquals": {"patata_2": ["test_2", "test_3"]},
        }
    ) == StatementCondition(
        ForAllValuesArnEqualsIfExists={"patata_1": "test_1"}, ForAnyValueARNEquals={"patata_2": ["test_2", "test_3"]}
    )
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
            StatementCondition(BinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "BinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(BinaryEqualsIfExists={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "BinaryEqualsIfExists",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAllValuesBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAllValuesBinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAllValuesBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAllValuesBinaryEquals",
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
            StatementCondition(BinaryEqualsIfExists={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "BinaryEqualsIfExists",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAllValuesBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAllValuesBinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAllValuesBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAllValuesBinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAnyValueBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAnyValueBinaryEquals",
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
            StatementCondition(ForAnyValueBinaryEqualsIfExists={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAnyValueBinaryEqualsIfExists",
            {"key": b"BinaryValueInBase64"},
        ),
    ],
)
def test_statement_condition_validate_binary(
    statement_condition: StatementCondition, attribute: str, expected_output: bytearray
):
    assert getattr(statement_condition, attribute) == expected_output
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
        (StatementCondition(NumericEquals={"patata": 1}), {"patata": 1}, True),
        (StatementCondition(NumericEquals={"patata": 1}), {"patata": 2}, False),
        (
            StatementCondition(NumericEquals={"patata_1": 1}, StringEquals={"patata_2": "A"}),
            {"patata_1": 1, "patata_2": "A"},
            True,
        ),
        (
            StatementCondition(NumericEquals={"patata_1": 1}, StringEquals={"patata_2": "A"}),
            {"patata_1": 2, "patata_2": "A"},
            False,
        ),
        (
            StatementCondition(NumericEquals={"patata_1": 1}, StringEquals={"patata_2": "A"}),
            {"patata_1": 1, "patata_2": "B"},
            False,
        ),
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
            StatementCondition(ForAnyValueBinaryEquals={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAnyValueBinaryEquals",
            {"key": b"BinaryValueInBase64"},
        ),
        (
            StatementCondition(ForAnyValueBinaryEqualsIfExists={"key": "QmluYXJ5VmFsdWVJbkJhc2U2NA=="}),
            "ForAnyValueBinaryEqualsIfExists",
            {"key": b"BinaryValueInBase64"},
        ),
    ],
)
def test_statement_condition_validate_binary(
    statement_condition: StatementCondition, attribute: str, expected_output: bytearray
):
    assert getattr(statement_condition, attribute) == expected_output
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
            StatementCondition(NumericEquals={"patata_1": 1}, StringEquals={"patata_2": "A"}),
            {"patata_1": 1, "patata_2": "A"},
            True,
        ),
        (
            StatementCondition(NumericEquals={"patata_1": 1}, StringEquals={"patata_2": "A"}),
            {"patata_1": 2, "patata_2": "A"},
            False,
        ),
        (
            StatementCondition(NumericEquals={"patata_1": 1}, StringEquals={"patata_2": "A"}),
            {"patata_1": 1, "patata_2": "B"},
            False,
        ),
        (
            StatementCondition(NumericEquals={"patata_1": 1}, StringEquals={"patata_2": "A"}),
            {"patata_1": 2, "patata_2": "B"},
github Skyscanner / pycfmodel / tests / resources / properties / test_statement_condition.py View on Github external
def test_statement_condition_remove_colon():
    assert StatementCondition.parse_obj(
        {
            "ForAllValues:ArnEqualsIfExists": {"patata_1": "test_1"},
            "ForAnyValue:ARNEquals": {"patata_2": ["test_2", "test_3"]},
        }
    ) == StatementCondition(
        ForAllValuesArnEqualsIfExists={"patata_1": "test_1"}, ForAnyValueARNEquals={"patata_2": ["test_2", "test_3"]}
    )