tests.py

Unittests for the service functions

Class definitions:

class apps.service.tests.ServiceTest(methodName='runTest')[source]

Bases: core.unittest.baseunittest.BaseUnitTest

Test the service functions

reminder_checks(healthperson, body_test, check_email, check_sms)[source]

Checks if reminders have been sent via the SMS and e-mail stores that catch SMS and e-mail traffic during testing

Args:
  • healthperson: healthperson to pick the e-mail address to test from
  • body_test: the body of the message to test for
  • check_email: do need to check e-mail?
  • check_sms: do need to check sms?
do_reminder_check(body_test, function, attr_name, function_instance, attr_instance, check_instance)[source]

Runner for checking reminders, highly abstracted

Args:
  • body_test: the body to test for
  • function: the function to call with function_instance
  • attr_name: the attr_name to set on attr_instance
  • function_instance: the param to sent to the function
  • check_instance: the instance to check, should be a healthperson

See example in ‘do_test_questionnaire_fillin_sms’ to see what is sent. for the specific args

do_questionnaire_check(body_test, function, attr_name)[source]

Helper function for checking questionnaire reminder functions

Args:
  • body_test: the body to test for
  • function: the function to call before checking
  • attr_name: the attr_name to set before checking
do_report_check(body_test, function, attr_name)[source]

Helper function for checking report reminder functions

Args:
  • body_test: the body to test for
  • function: the function to call before checking
  • attr_name: the attr_name to set before checking
do_test_questionnaire_fillin_sms()[source]

Check if the questionnaire fillin sms/email function works correctly

do_test_questionnaire_reminder_sms()[source]

Check if the questionnaire reminder sms/email function works correctly

do_test_urgent_report_reminder()[source]

Check if the urgent report reminder sms/email function works correctly

do_test_report_reminder()[source]

Check if the report reminder sms/email function works correctly

do_test_remove_deleted_patients()[source]

Check if patients are automatically deleted

do_test_check_questionnaire_fillin_deadlines()[source]

Check if the questionnaire fillin deadlines function works

create_questionnaire_request(patient, date_time, is_handled)[source]

Creates a questionnaire request

Args:
  • patient: the patient to couple to the questionnaire request
  • date_time: the date & time to set as finished date
  • is_handled: set the handled_on to date_time if True
do_test_insert_new_questionnaire_requests()[source]

Checks if insert new questionnaire request functions works correctly by testing a range of different scenario’s

unhandeld_questionnaires_helper(urgent)[source]

Helper functions for testing unhandeld questionnaires

Args:
  • urgent: check urgent or not urgent
do_test_unhandeld_questionnaires()[source]

Check if reminder are sent to an healhprofessional for unhandeld filled-in questionnaires

test_service_functions()[source]

Test runner which performs all checks