pittcsc / PittAPI

An API to easily get data from the University of Pittsburgh
https://pittapi.pittcsc.org
GNU General Public License v2.0
105 stars 30 forks source link

Broken/outdated tests for dining module #164

Closed tianyizheng02 closed 1 month ago

tianyizheng02 commented 1 month ago

@akrishan11 @nij-patel The PR #161 breaks the dining module tests. See the errors that I get in #163:

FAILED tests/dining_test.py::DiningTest::test_get_dining_locations - requests.exceptions.ConnectionError: Connection refused by Responses - the call doesn't match any registered mock.

Request: 
- GET https://api.dineoncampus.com/v1/locations/status?site_id=5e6fcc641ca48e0cacd93b04&platform=

Available matches:
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=0 URL does not match
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=10 URL does not match
- GET https://m.pitt.edu/dining/index.json?feed=dining_locations&_kgoui_object=kgoui_Rcontent_I2&start=20 URL does not match
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations_by_status_closed - AttributeError: module 'pittapi.dining' has no attribute 'get_locations_by_status'
FAILED tests/dining_test.py::DiningTest::test_get_dining_locations_by_status_open - AttributeError: module 'pittapi.dining' has no attribute 'get_locations_by_status'

For instance, the PR deleted the get_dining_locations_by_status function, so that automatically breaks two of the three tests in dining_test.py. I think the first test is failing because of changed URLs that weren't likewise updated in the test.

In any case, the unit tests need to be updated to properly test the new API, and all new PRs will be blocked until then. We can either put all PRs on hold until these new tests are written, or we can temporarily disable testing for the dining module for the time being.

nij-patel commented 1 month ago

yep, Akash is working on updating the tests