Example #1
0
def report(args):
    service = AdService()
    reports = service.report(
        client=args.client,
        start=args.start,
        end=args.end,
    )
    print_report(reports)
Example #2
0
    def test_report_service(self, report_input, report_dto, mocker):
        report_input_dto = mocker.patch(
            'src.services.adservice.ReportInputDTO')

        adreg_mock = mocker.patch('src.services.adservice.AdReg')
        reports = [report_dto for i in range(5)]
        adreg_mock().create_report.return_value = reports

        service = AdService()
        result = service.report(
            client=report_input.client,
            start='5-4-2021',
            end='7-5-2021',
        )

        report_input_dto.assert_called_once_with(
            client=report_input.client,
            start=date(2021, 4, 5),
            end=date(2021, 5, 7),
        )

        adreg_mock().create_report.assert_called_once_with(report_input_dto())
        assert result == reports