Skip to content

Refactor integration tests of server #897

Closed
@krivard

Description

@krivard

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions