Closed DragonWarrior15 closed 3 years ago
The final test whose code is listed below fails
def test_min_age_limit_filter(): cowin = CoWinAPI() availability = cowin.get_availability_by_district("395", min_age_limt=18) assert isinstance(availability, dict) assert isinstance(availability.get('centers'), list) assert len(availability.get('centers')[0].get('sessions')) == 0
Reason: Date is not specified, hence the results will keep changing daily depending on when the tests are run.
Solution: Pass the date parameter and accordingly correct the final assertion test (based on the readme). The below code passes the tests
def test_min_age_limit_filter(): cowin = CoWinAPI() availability = cowin.get_availability_by_district("395", date="03-05-2021", min_age_limt=18) assert isinstance(availability, dict) assert isinstance(availability.get('centers'), list) assert len(availability.get('centers')[0].get('sessions')) == 2
Also, in the constants file, date format needs to be corrected to be consistent with the API, DD_MM_YYYY = "%d-%m-%y" to DD_MM_YYYY = "%d-%m-%Y".
DD_MM_YYYY = "%d-%m-%y"
DD_MM_YYYY = "%d-%m-%Y"
Thanks, @DragonWarrior15 for the PR. It was an oversight from my end
The final test whose code is listed below fails
Reason: Date is not specified, hence the results will keep changing daily depending on when the tests are run.
Solution: Pass the date parameter and accordingly correct the final assertion test (based on the readme). The below code passes the tests
Also, in the constants file, date format needs to be corrected to be consistent with the API,
DD_MM_YYYY = "%d-%m-%y"
toDD_MM_YYYY = "%d-%m-%Y"
.