示例#1
0
def test_attachment_page(batch, petition, offense1):
    for i in range(20):
        offense_record = OffenseRecordFactory(offense=offense1)
        petition.offense_records.add(offense_record)
    paginator = OffenseRecordPaginator(petition)
    assert len(paginator.petition_offense_records()) == 10
    has_attachment = None
    for attachment_records in paginator.attachment_offense_records():
        has_attachment = True
        assert len(attachment_records) == 10
    assert has_attachment
示例#2
0
    def get_offense_record_paginator(self):
        from dear_petition.petition.etl.paginator import OffenseRecordPaginator

        return OffenseRecordPaginator(self)
def test_paginator_attachment_page_size(petition, attachment_page_size,
                                        expected):
    paginator = OffenseRecordPaginator(
        petition, attachment_page_size=attachment_page_size)
    assert paginator.attachment_page_size == expected
def test_paginator_initial_page_size(petition, initial_page_size, expected):
    paginator = OffenseRecordPaginator(petition,
                                       initial_page_size=initial_page_size)
    assert paginator.initial_page_size == expected
示例#5
0
def paginator(petition):
    return OffenseRecordPaginator(petition)
示例#6
0
    def get_offense_record_paginator(self, filter_active=True):
        from dear_petition.petition.etl.paginator import OffenseRecordPaginator

        return OffenseRecordPaginator(self, filter_active=filter_active)