Skip to content

Commit

Permalink
Merge pull request #135 from IndicoDataSolutions/add_num_pages_to_report
Browse files Browse the repository at this point in the history
adding two attributes to doc reports
  • Loading branch information
Scott771 authored Feb 2, 2022
2 parents a168c2a + f219c9e commit f5dcbac
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions indico/queries/document_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class GetDocumentReport(PagedRequest):
inputFiles{
filename
submissionId
fileSize
numPages
}
}
pageInfo{
Expand Down
2 changes: 2 additions & 0 deletions indico/types/document_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class InputFile(BaseType):
filename: str
submission_id: int
num_pages: int
file_size: int


class DocumentReport(BaseType):
Expand Down
13 changes: 11 additions & 2 deletions tests/integration/queries/test_document_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,30 @@
from indico.types.document_report import DocumentReport
from indico.filters import DocumentReportFilter


def test_fetch_docs(indico):
client = IndicoClient()

document_report: List[DocumentReport] = client.call(GetDocumentReport())
assert document_report is not None
assert len(document_report) > 0
assert isinstance(document_report[0].input_files[0].num_pages, int)
assert isinstance(document_report[0].input_files[0].file_size, int)


def test_fetch_docs_limit(indico):
client = IndicoClient()
filter_opts = DocumentReportFilter(created_at_start_date= datetime(2021,7,1), created_at_end_date = datetime.now())
document_report: List[DocumentReport] = client.call(GetDocumentReport(filters=filter_opts, limit=5))
filter_opts = DocumentReportFilter(
created_at_start_date=datetime(2021, 7, 1), created_at_end_date=datetime.now()
)
document_report: List[DocumentReport] = client.call(
GetDocumentReport(filters=filter_opts, limit=5)
)
assert document_report is not None
assert len(document_report) > 0
assert len(document_report) <= 5


def test_pagination(indico):
client = IndicoClient()
document_report: List[DocumentReport] = []
Expand Down

0 comments on commit f5dcbac

Please sign in to comment.