def _build_tests()

in features/0006-awses-message-decryption-generation-generate.py [0:0]


def _build_tests(keys):
    """Build all tests to define in manifest, building from current rules and provided keys manifest.

    :param dict keys: Parsed keys manifest
    """
    for algorithm in ALGORITHM_SUITES:
        for frame_size in FRAME_SIZES:
            for ec in ENCRYPTION_CONTEXTS:
                for provider_set in _providers(keys):
                    yield (
                        str(uuid.uuid4()),
                        {
                            "encryption-scenario": {
                                "plaintext": "small",
                                "algorithm": algorithm,
                                "frame-size": frame_size,
                                "encryption-context": ec,
                                "master-keys": provider_set,
                            }
                        },
                    )

    yield (
        str(uuid.uuid4()),
        {
            "encryption-scenario": {
                "plaintext": "tiny",
                "algorithm": "0178",
                "frame-size": 512,
                "encryption-context": UNPRINTABLE_UNICODE_ENCRYPTION_CONTEXT,
                "master-keys": next(_raw_aes_providers(keys)),
            },
            "decryption-method": "streaming-unsigned-only"
        },
    )

    yield (
        str(uuid.uuid4()),
        {
            "encryption-scenario": {
                "plaintext": "tiny",
                "algorithm": "0378",
                "frame-size": 512,
                "encryption-context": UNPRINTABLE_UNICODE_ENCRYPTION_CONTEXT,
                "master-keys": next(_raw_aes_providers(keys)),
            },
            "decryption-method": "streaming-unsigned-only",
            "result": {
                "error": {
                    "error-description": "Signed message input to streaming unsigned-only decryption method"
                }
            }
        }
    )

    for tampering in TAMPERINGS:
        yield (
            str(uuid.uuid4()),
            {
                "encryption-scenario": {
                    "plaintext": "tiny",
                    "algorithm": "0478" if tampering == "half-sign" else "0578",
                    "frame-size": 512,
                    "encryption-context": UNPRINTABLE_UNICODE_ENCRYPTION_CONTEXT,
                    "master-keys": next(_raw_aes_providers(keys)),
                },
                "tampering": tampering
            }
        )

    yield (
        str(uuid.uuid4()),
        {
            "encryption-scenario": {
                "plaintext": "tiny",
                "algorithm": "0578",
                "frame-size": 512,
                "encryption-context": UNPRINTABLE_UNICODE_ENCRYPTION_CONTEXT,
                "master-keys": next(_raw_aes_providers(keys)),
            },
            "tampering": {
                "change-edk-provider-info": [
                    "arn:aws:kms:us-west-2:658956600833:alias/EncryptOnly"
                ]
            },
            "decryption-master-keys": [
                {
                    "type": "aws-kms",
                    "key": "us-west-2-encrypt-only"
                }
            ]
        },
    )