11"""Tests for async helper functions for managing a Vuforia database."""
22
33import base64
4+ import datetime # noqa: TC003
45import io # noqa: TC003
56import time
67import uuid
@@ -509,12 +510,13 @@ class TestRecoCountsReport:
509510 async def test_reco_counts_report (
510511 * ,
511512 async_vws_client : AsyncVWS ,
512- report_month : str ,
513+ report_month : datetime . date ,
513514 ) -> None :
514515 """A report can be requested, waited for and downloaded."""
515516 client = async_vws_client
516517 report_request = await client .request_database_reco_counts_report (
517- month = report_month ,
518+ year = report_month .year ,
519+ month = report_month .month ,
518520 )
519521 assert report_request .transaction_id
520522 assert report_request .presigned_url
@@ -529,7 +531,7 @@ async def test_reco_counts_report(
529531
530532 @staticmethod
531533 @pytest .mark .asyncio
532- async def test_not_ready (* , current_month : str ) -> None :
534+ async def test_not_ready (* , current_month : datetime . date ) -> None :
533535 """Downloading a report before Vuforia has generated it raises an
534536 error.
535537 """
@@ -543,7 +545,8 @@ async def test_not_ready(*, current_month: str) -> None:
543545 ) as client :
544546 report_request = (
545547 await client .request_database_reco_counts_report (
546- month = current_month ,
548+ year = current_month .year ,
549+ month = current_month .month ,
547550 )
548551 )
549552
@@ -558,7 +561,7 @@ async def test_not_ready(*, current_month: str) -> None:
558561
559562 @staticmethod
560563 @pytest .mark .asyncio
561- async def test_wait_timeout (* , current_month : str ) -> None :
564+ async def test_wait_timeout (* , current_month : datetime . date ) -> None :
562565 """Waiting for a report which is not generated in time raises an
563566 error.
564567 """
@@ -572,7 +575,8 @@ async def test_wait_timeout(*, current_month: str) -> None:
572575 ) as client :
573576 report_request = (
574577 await client .request_database_reco_counts_report (
575- month = current_month ,
578+ year = current_month .year ,
579+ month = current_month .month ,
576580 )
577581 )
578582
@@ -594,19 +598,24 @@ async def test_wait_timeout(*, current_month: str) -> None:
594598 @staticmethod
595599 @pytest .mark .asyncio
596600 @pytest .mark .parametrize (
597- argnames = "month" ,
598- argvalues = ["1999-01" , "not-a-month" ],
601+ argnames = ("year" , "month" ),
602+ argvalues = [
603+ pytest .param (1999 , 1 , id = "month-in-the-past" ),
604+ pytest .param (1999 , 13 , id = "month-out-of-range" ),
605+ ],
599606 )
600607 async def test_month_not_accepted (
601608 * ,
602609 async_vws_client : AsyncVWS ,
603- month : str ,
610+ year : int ,
611+ month : int ,
604612 ) -> None :
605613 """Months other than the current and previous month are
606614 rejected.
607615 """
608616 with pytest .raises (expected_exception = FailError ) as exc :
609617 await async_vws_client .request_database_reco_counts_report (
618+ year = year ,
610619 month = month ,
611620 )
612621
@@ -616,7 +625,7 @@ async def test_month_not_accepted(
616625 @pytest .mark .asyncio
617626 async def test_database_id_does_not_match_keys (
618627 * ,
619- current_month : str ,
628+ current_month : datetime . date ,
620629 ) -> None :
621630 """A database ID which does not match the given keys is
622631 rejected.
@@ -633,7 +642,8 @@ async def test_database_id_does_not_match_keys(
633642 expected_exception = AuthenticationFailureError ,
634643 ) as exc :
635644 await client .request_database_reco_counts_report (
636- month = current_month ,
645+ year = current_month .year ,
646+ month = current_month .month ,
637647 )
638648
639649 assert (
@@ -660,7 +670,7 @@ async def test_download_error() -> None:
660670
661671 @staticmethod
662672 @pytest .mark .asyncio
663- async def test_no_database_id (* , current_month : str ) -> None :
673+ async def test_no_database_id (* , current_month : datetime . date ) -> None :
664674 """A client which was given no database ID cannot request a
665675 report.
666676 """
@@ -670,7 +680,8 @@ async def test_no_database_id(*, current_month: str) -> None:
670680 ) as client :
671681 with pytest .raises (expected_exception = DatabaseIdNotSetError ):
672682 await client .request_database_reco_counts_report (
673- month = current_month ,
683+ year = current_month .year ,
684+ month = current_month .month ,
674685 )
675686
676687
0 commit comments