Skip to content

Refactor integration tests of server #897

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
krivard opened this issue Apr 11, 2022 · 2 comments
Closed

Refactor integration tests of server #897

krivard opened this issue Apr 11, 2022 · 2 comments

Comments

@krivard
Copy link
Contributor

krivard commented Apr 11, 2022

The integration tests of the server code are arduous to maintain, largely because they violate best practices:

  • Avoid copy-pasted code
  • Use the least complex example that adequately exercises the code under test

We want to refactor it to address these problems by adding a helper module. This helper module should include (a hierarchy of?) testcase superclasses to support:

  • setting Epidata.BASE_URL and secrets
  • truncating tables
  • loading data
    • should isolate variations so they are easy to read and reason about at the point of use
    • should return a dict in epidata response format using same ordering
    • should feel free to use the associated database.Database as a helper -- these are server tests; database.Database should have been tested elsewhere

The files affected:

  • integrations/server/test_covid_hosp.py - has a reasonable example of what loading data might look like
  • integrations/server/test_covidcast.py
  • integrations/server/test_covidcast_endpoints.py
  • integrations/server/test_covidcast_meta.py
  • integrations/server/test_covidcast_nowcast.py
  • integrations/server/test_fluview.py - setup only
  • integrations/server/test_fluview_meta.py - setup only
@melange396
Copy link
Collaborator

this example could be a decent start for some of these points: https://github.com/cmu-delphi/delphi-epidata/blob/e0fb58b4cee56e97c29dd81fe54db42a9690e7e4/integrations/acquisition/covidcast/test_db.py

also, collapse multiple definitions of CovidcastRow into one

@krivard
Copy link
Contributor Author

krivard commented Sep 8, 2022

Fixed in #959

@krivard krivard closed this as completed Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants