Example #1
0
def test_get_change_dict(document_type, with_toc, expected_checksum):
    chapter = ChapterFactory()
    chapter_with_checksum = ChapterFactory(
        id=2,
        schedule_document_check_sum=schedule_checksum,
        classification_document_check_sum=classification_checksum,
    )
    expected_change_dict = {
        chapter.get_document_name(document_type): None,
        chapter_with_checksum.get_document_name(document_type):
        expected_checksum,
    }

    if with_toc:
        MFNTableOfContentFactory(
            document_check_sum=toc_checksum,
            document_type=document_type,
        )
        expected_change_dict['toc'] = toc_checksum
    app = Application(document_type)
    actual_change_dict = app.get_change_dict()
    assert actual_change_dict == expected_change_dict
def test_chapter_model():
    chapter = ChapterFactory(description='Chapter description')
    assert str(chapter) == '01 - Chapter description'
    assert chapter.chapter_string == '01'
    assert chapter.get_document_name(SCHEDULE) == 'schedule01.docx'