tests.py

Contains questionnaire tests. By default only tests the wizard questionnaire processes only for one diagnose. But all other forms are tested seperately.

Class definitions:

class apps.questionnaire.tests.MockWizard[source]

Mock Wizard object with a method for getting the cleaned_data

get_cleaned_data_for_form_class(form_class)[source]

Get the cleaned data for a form_class

Args:
The form_class, unused
Returns:
self.cleaned_data
class apps.questionnaire.tests.QuestionnaireTest(methodName='runTest')[source]

Bases: core.unittest.baseunittest.BaseUnitTest

Provides tests for testing Questionnaires

questionnaire_post_form(res, url, status_code=200, save_and_exit=False, previous_step=False)[source]

Post a questionnaire form

Args:
  • res: the response instance
  • url: the url to post to
  • status_code: the expected status_code (default=200)
  • save_and_exit: perform a save and exit the questionnaire
  • previouse_step: if True go one step back
Returns:
The response instance after posting
run_questionnaire(urgent=False)[source]

Runs a complete set of questionnaires for an urgent or normal control

Args:
  • urgent: run the urgent control
get_questionnaire_fields_from_object(obj)[source]

Gets the questionnaire fields from a given questionnaire instance

Args:
  • obj: the Questionnaire instance
Returns:
  • All fields from the obj
run_questionnaire_for_patient(email, urgent=False)[source]

Runs a full control for a patient

Args:
  • email: the email to use for login
  • urgent: if true run it for an urgent control
check_form(form_class)[source]

Check some default form methods for a given form_class

Args:
  • form_class: the form_class to check
check_other_forms()[source]

Run over all other (untested) questionnaire forms by initializing, cleaning and checking the ‘condition’ function

check_controle_process()[source]

To speed up testing only do the whole control and urgent control for one patient. All other forms that are not hit by this test are tested in the ‘check_other_forms’ function

Currently testes the following diagnoses:
colitis_ulcerosa (= same as chron), intestinal_transplantation, rheumatoid_arthritis
check_controle_navigation(urgent)[source]

Partially fill in control and check the navigation functionality + save partially filled in & return

test_controles()[source]

Questionnaire tests runner