Tests - DDMAL/CantusDB GitHub Wiki

CantusDB has several test suites that should be run and kept up-to-date: one for the users app, one for the articles app, and two for the main_app app.

Tests for main_app

Tests for the main_app app are kept in main_app/tests (directory)

There are three test suites that should be run:

  • test_models.py (code)
    • run with python -Wa manage.py test main_app.tests.test_models (the -Wa flag tells Python to display deprecation warnings)
  • test_views.py (code)
    • run with python -Wa manage.py test main_app.tests.test_views
  • test_functions.py (code)
    • run with python -Wa manage.py test main_app.tests.test_functions

main_app/tests contains two additional files:

  • make_fakes.py (code): contains a number of functions used in the tests in test_models.py and test_views.py
  • test_input.py (code): This test suite is out-of-date and should not be run. It contains a few failing tests of the Chant Create view; eventually, these tests might be fixed and added to test_views.py

Tests for articles

Tests for the articles app are kept in articles/tests (directory).

There is one test suite that should be run:

  • test_articles.py (code)
    • run with python -Wa manage.py test articles.tests.test_articles

Tests for users

Tests for the users app are kept in users/tests.py (code).

There is one test suite that should be run:

  • tests.py (code)
    • run with python -Wa manage.py test users.tests