"""Test model/evidence.py."""

import base64
import filecmp
from pathlib import Path

from cryptography.hazmat.primitives.serialization import (
    Encoding,
    PublicFormat,
    load_pem_public_key,
)
from cryptography.x509 import load_pem_x509_certificate, load_pem_x509_crl

from cenclave.core.no_sgx_docker import NoSgxDockerConfig
from cenclave.model.evidence import ApplicationEvidence


def test_load():
    """Test `load` function."""
    json_path = Path(__file__).parent / "data/evidence.json"
    conf = ApplicationEvidence.load(path=json_path)

    ref_conf = ApplicationEvidence(
        input_args=NoSgxDockerConfig(
            host="localhost",
            subject="CN=localhost,O=MyApp Company,C=FR,L=Paris,ST=Ile-de-France",
            subject_alternative_name="localhost",
            expiration_date=1714058115,
            size=4096,
            app_id="63322f85-1ff8-4483-91ae-f18d7398d157",
            application="app:app",
        ),
        ratls_certificate=load_pem_x509_certificate(
            b"-----BEGIN CERTIFICATE-----\nMIIUfDCCFCKgAwIBAgITdFsNOA0J4klfaNLxtAArloOHwjAKBggqhkjOPQQDAjBg\nMQswCQYDVQQGEwJGUjEWMBQGA1UECAwNSWxlLWRlLUZyYW5jZTEOMAwGA1UEBwwF\nUGFyaXMxFTATBgNVBAoMDENvc21pYW4gVGVjaDESMBAGA1UEAwwJbG9jYWxob3N0\nMB4XDTIzMDUxNzA5Mzg0MloXDTI0MDQyNjA5MzgzM1owYDELMAkGA1UEBhMCRlIx\nFjAUBgNVBAgMDUlsZS1kZS1GcmFuY2UxDjAMBgNVBAcMBVBhcmlzMRUwEwYDVQQK\nDAxDb3NtaWFuIFRlY2gxEjAQBgNVBAMMCWxvY2FsaG9zdDBZMBMGByqGSM49AgEG\nCCqGSM49AwEHA0IABJRCBMEF70mXMUT58XTvOlLo9mAr6vAYQvf+gmIAf/v1uFl8\nd+7DKP7aV9jA6jI4rJ1jO1vrMX0dT8AbMft7tA6jghK5MIIStTAUBgNVHREEDTAL\ngglsb2NhbGhvc3QwghKNBgkqhkiG+E2KOQYEghJ+AwACAAAAAAAJAA4Ak5pyM/ec\nTKmUCg2zlX8GB0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1JnSWhBT1cvNVFrUitTOUNp\nU0RjTm9vd0x1UFJMc1dHZi9ZaTdHU1g5NEJnd1R3ZwpBaUVBNEowbHJIb01zK1hv\nNW8vc1g2TzlRV3hIUkF2WlVHT2RSUTdjdnFSWGFxST0KLS0tLS1FTkQgQ0VSVElG\nSUNBVEUtLS0tLQoAMAwGA1UdEwEB/wQCMAAwCgYIKoZIzj0EAwIDSAAwRQIhAI1O\nnFt7sEjvhtWi+G5Ewr1bhLD9mvvHRy24MUwbs08eAiAokkeGBBfREzIs5bU7+PtB\npLMzjW4ikTqPVuAq0bhKzA==\n-----END CERTIFICATE-----\n"
        ),
        root_ca_crl=load_pem_x509_crl(
            b"-----BEGIN X509 CRL-----\nMIIBITCByAIBATAKBggqhkjOPQQDAjBoMRowGAYDVQQDDBFJbnRlbCBTR1ggUm9v\ndCBDQTEaMBgGA1UECgwRSW50ZWwgQ29ycG9yYXRpb24xFDASBgNVBAcMC1NhbnRh\nIENsYXJhMQswCQYDVQQIDAJDQTELMAkGA1UEBhMCVVMXDTIzMDQwMzEwMjI1MVoX\nDTI0MDQwMjEwMjI1MVqgLzAtMAoGA1UdFAQDAgEBMB8GA1UdIwQYMBaAFCJlDNZa\nnTSJ84O0lVK/UBs5JwasMAoGCCqGSM49BAMCA0gAMEUCIFFXfUfZ+6FXtl8etfRl\ne7xeVsyvc1oD8blj1wSAWrEYAiEAk5AV7BY25+r6X0JsHkAmR8ZzEytoUMq9aM72\nutdoKgM=\n-----END X509 CRL-----\n"
        ),
        pck_platform_crl=load_pem_x509_crl(
            b"-----BEGIN X509 CRL-----\nMIIKYjCCCggCAQEwCgYIKoZIzj0EAwIwcDEiMCAGA1UEAwwZSW50ZWwgU0dYIFBD\nSyBQbGF0Zm9ybSBDQTEaMBgGA1UECgwRSW50ZWwgQ29ycG9yYXRpb24xFDASBgNV\nBAcMC1NhbnRhIENsYXJhMQswCQYDVQQIDAJDQTELMAkGA1UEBhMCVVMXDTIzMDUx\nNjIzNTU0MVoX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UxNjIzNTU0MVowDDAKBgNVHRUEAwoBATA0AhUAoXxRci7B4MMnj+i98FIFnL7E\n5kgXDTIzMDUxNjIzNTU0MVowDDAKBgNVHRUEAwoBAaAvMC0wCgYDVR0UBAMCAQEw\nHwYDVR0jBBgwFoAUlW9dzb0b4elAScnU9DPOAVcL3lQwCgYIKoZIzj0EAwIDSAAw\nRQIgDVriOusQw5Z75VNbKtK/CF26SZhsR7XYjOWZfBardbUCIQCST8LtavMRfBZT\nll0lzk4y1TQ9DtdJdB0IYrdG00OxLQ==\n-----END X509 CRL-----\n"
        ),
        tcb_info=base64.b64decode(
            " ".encode(
                "utf-8"
            )
        ),
        qe_identity=base64.b64decode(
            "eyJlbmNsYXZlSWRlbnRpdHkiOnsiaWQiOiJRRSIsInZlcnNpb24iOjIsImlzc3VlRGF0ZSI6IjIwMjMtMDYtMjBUMDA6MjQ6MDJaIiwibmV4dFVwZGF0ZSI6IjIwMjMtMDctMjBUMDA6MjQ6MDJaIiwidGNiRXZhbHVhdGlvbkRhdGFOdW1iZXIiOjE1LCJtaXNjc2VsZWN0IjoiMDAwMDAwMDAiLCJtaXNjc2VsZWN0TWFzayI6IkZGRkZGRkZGIiwiYXR0cmlidXRlcyI6IjExMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwIiwiYXR0cmlidXRlc01hc2siOiJGQkZGRkZGRkZGRkZGRkZGMDAwMDAwMDAwMDAwMDAwMCIsIm1yc2lnbmVyIjoiOEM0RjU3NzVENzk2NTAzRTk2MTM3Rjc3QzY4QTgyOUEwMDU2QUM4REVENzAxNDBCMDgxQjA5NDQ5MEM1N0JGRiIsImlzdnByb2RpZCI6MSwidGNiTGV2ZWxzIjpbeyJ0Y2IiOnsiaXN2c3ZuIjo4fSwidGNiRGF0ZSI6IjIwMjMtMDItMTVUMDA6MDA6MDBaIiwidGNiU3RhdHVzIjoiVXBUb0RhdGUifSx7InRjYiI6eyJpc3Zzdm4iOjZ9LCJ0Y2JEYXRlIjo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zMjBkMDRjMDI0MDY2NTViYjQxNzc0ZWUwMjc4YWViY2Y0Mjk2YjUzZTQ2NDQ3OTc2NTZlYjNjNzVhYTRmNzE2YTAzODkyZmRjMGE3MzY3MTY5YmU2OCJ9".encode(
                "utf-8"
            )
        ),
        tcb_cert=load_pem_x509_certificate(
            b"-----BEGIN CERTIFICATE-----\nMIICizCCAjKgAwIBAgIUfjiC1ftVKUpASY5FhAPpFJG99FUwCgYIKoZIzj0EAwIw\naDEaMBgGA1UEAwwRSW50ZWwgU0dYIFJvb3QgQ0ExGjAYBgNVBAoMEUludGVsIENv\ncnBvcmF0aW9uMRQwEgYDVQQHDAtTYW50YSBDbGFyYTELMAkGA1UECAwCQ0ExCzAJ\nBgNVBAYTAlVTMB4XDTE4MDUyMTEwNTAxMFoXDTI1MDUyMTEwNTAxMFowbDEeMBwG\nA1UEAwwVSW50ZWwgU0dYIFRDQiBTaWduaW5nMRowGAYDVQQKDBFJbnRlbCBDb3Jw\nb3JhdGlvbjEUMBIGA1UEBwwLU2FudGEgQ2xhcmExCzAJBgNVBAgMAkNBMQswCQYD\nVQQGEwJVUzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABENFG8xzydWRfK92bmGv\nP+mAh91PEyV7Jh6FGJd5ndE9aBH7R3E4A7ubrlh/zN3C4xvpoouGlirMba+W2lju\nypajgbUwgbIwHwYDVR0jBBgwFoAUImUM1lqdNInzg7SVUr9QGzknBqwwUgYDVR0f\nBEswSTBHoEWgQ4ZBaHR0cHM6Ly9jZXJ0aWZpY2F0ZXMudHJ1c3RlZHNlcnZpY2Vz\nLmludGVsLmNvbS9JbnRlbFNHWFJvb3RDQS5kZXIwHQYDVR0OBBYEFH44gtX7VSlK\nQEmORYQD6RSRvfRVMA4GA1UdDwEB/wQEAwIGwDAMBgNVHRMBAf8EAjAAMAoGCCqG\nSM49BAMCA0cAMEQCIB9C8wOAN/ImxDtGACV246KcqjagZOR0kyctyBrsGGJVAiAj\nftbrNGsGU8YH211dRiYNoPPu19Zp/ze8JmhujB0oBw==\n-----END CERTIFICATE-----\n"
        ),
        signer_pk=load_pem_public_key(
            b"-----BEGIN PUBLIC KEY-----\nMIIBoDANBgkqhkiG9w0BAQEFAAOCAY0AMIIBiAKCAYEAwJ1w0FTxi683hkxrg9fG\nSZ6AvDbfvsh52dPgrgRIB9jkIW1eJacXyuNZHznOKl+T/QaHorfNg+e6IB9Jaa80\nyeqp7lewtF7nG4CB83qSeU/GbehuYQeuTlIPvIZrrMl9DviiADOu7cCvRTVLcyj8\n1pKuWpWuUC0LVE8o6JsG8Zk89Qj653oJl+926koOAaQZ203w2fKhbXTEoyaaysbe\n2jzabuPWIFafxPiSO6p+UcXs+CzJfaZkVKBWAhHBZN5DYr+JhYqOJlb3bvsAxGuS\n4mWgxx1OGRXTJq1uHQvZOuOprUICqiYoc6UJAT5MiMOofwng498KXLl0Yg4qAYI3\nDCdYEiFC5URJzvlQzQzHV6q4mTep2YXtIUcCsiomFM3ldZVEXGtpST+qqQUKIEiC\n3nqLhX5YogqFbOm/xhE/RCgVWb7J4aSW9/+ohwwsRM7eRFTFylBv2BLcP5gl/f9P\nuMX6e9Bd/TxRj5tkk7BLfex6gdfVRWnJ1Odhht1AyyYXAgED\n-----END PUBLIC KEY-----\n"
        ),
    )

    assert conf.input_args == ref_conf.input_args
    assert conf.ratls_certificate == ref_conf.ratls_certificate
    assert conf.root_ca_crl == ref_conf.root_ca_crl
    assert conf.pck_platform_crl == ref_conf.pck_platform_crl
    assert conf.signer_pk.public_bytes(
        encoding=Encoding.PEM,
        format=PublicFormat.SubjectPublicKeyInfo,
    ) == ref_conf.signer_pk.public_bytes(
        encoding=Encoding.PEM,
        format=PublicFormat.SubjectPublicKeyInfo,
    )
    assert conf.tcb_info == ref_conf.tcb_info
    assert conf.qe_identity == ref_conf.qe_identity
    assert conf.tcb_cert == ref_conf.tcb_cert


def test_save(workspace: Path):
    """Test the `save` method."""
    json = Path(__file__).parent / "data/evidence.json"
    conf = ApplicationEvidence.load(path=json)

    tmp_json = workspace / "evidence.json"
    conf.save(tmp_json)

    assert filecmp.cmp(json, tmp_json)
