def test_FO4_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 footnote.""" footnote = factories.FootnoteFactory.create( description__valid_between=date_ranges.later, ) with pytest.raises(BusinessRuleViolation): business_rules.FO4(footnote.transaction).validate(footnote)
def test_FO4_start_dates_cannot_match(): """No two associated description periods may have the same start date.""" footnote = factories.FootnoteFactory.create() duplicate = factories.FootnoteDescriptionFactory.create( described_footnote=footnote, valid_between=footnote.valid_between, ) with pytest.raises(BusinessRuleViolation): business_rules.FO4(duplicate.transaction).validate(footnote)
def test_FO4_description_start_before_footnote_end(date_ranges): """The start date must be less than or equal to the end date of the footnote.""" footnote = factories.FootnoteFactory.create( valid_between=date_ranges.normal, description__valid_between=date_ranges.starts_with_normal, ) early_description = factories.FootnoteDescriptionFactory.create( described_footnote=footnote, valid_between=date_ranges.later, ) with pytest.raises(BusinessRuleViolation): business_rules.FO4(early_description.transaction).validate(footnote)
def test_FO4_one_description_mandatory(): """At least one description record is mandatory.""" footnote = factories.FootnoteFactory.create(description=None) with pytest.raises(BusinessRuleViolation): business_rules.FO4(footnote.transaction).validate(footnote)