Beispiel #1
0
def test_CE6_first_description_must_have_same_start_date(date_ranges):
    """The start date of the first description period must be equal to the start
    date of the certificate."""

    description = factories.CertificateDescriptionFactory.create(
        described_certificate__valid_between=date_ranges.no_end,
        valid_between=date_ranges.later,
    )

    with pytest.raises(BusinessRuleViolation):
        business_rules.CE6(description.transaction).validate(
            description.described_certificate, )
Beispiel #2
0
def test_CE6_certificate_validity_period_must_span_description(date_ranges):
    """The validity period of the certificate must span the validity period of
    the certificate description."""

    description = factories.CertificateDescriptionFactory.create(
        described_certificate__valid_between=date_ranges.normal,
        valid_between=date_ranges.overlap_normal,
    )

    with pytest.raises(BusinessRuleViolation):
        business_rules.CE6(description.transaction).validate(
            description.described_certificate, )
Beispiel #3
0
def test_CE6_start_dates_cannot_match():
    """No two associated description periods for the same certificate and
    language may have the same start date."""

    existing = factories.CertificateDescriptionFactory.create()
    new_description = factories.CertificateDescriptionFactory.create(
        described_certificate=existing.described_certificate,
        valid_between=existing.valid_between,
    )

    with pytest.raises(BusinessRuleViolation):
        business_rules.CE6(new_description.transaction).validate(
            existing.described_certificate, )
Beispiel #4
0
def test_CE6_one_description_mandatory():
    """At least one description record is mandatory."""
    certificate = factories.CertificateFactory.create()
    with pytest.raises(BusinessRuleViolation):
        # certificate created without description
        business_rules.CE6(certificate.transaction).validate(certificate)