def test_certificate_missing_common_name(client, authority, session, logged_in_user):
    """CN is mandatory unless authority has option cn_optional set to true"""
    from lemur.certificates.schemas import CertificateInputSchema

    input_data = {
        "owner": "jim@example.com",
        "authority": {"id": authority.id},
        "description": "testtestest"
    }

    data, errors = CertificateInputSchema().load(input_data)
    assert errors["_schema"][0].startswith(
        "Missing common_name"
    )
CN is mandatory unless authority has option cn_optional set to true
lemur/tests/test_certificates.py