def test_view_locator_with_invalid_pat_id(self): """ Access with Valid Tester Permissions and Valid pat_id """ Test_Start() prn_info = False # We should search for this p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID) if prn_info!=False: print p usrname = USERNAME_FOR_TEST passwd=PASSWORD_FOR_TEST output = [] post_url = '/intake/view-locator/'+INVALID_PATIENT_ID post_parameters = {'pat_id':INVALID_PATIENT_ID} look_for_this = INVALID_PATIENT_FIRSTNAME+" "+INVALID_PATIENT_LASTNAME+" ("+INVALID_PATIENT_ID+")" calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2] # print "calling:["+calling_test_function+"]" Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for Invalid Pat_Id:"+INVALID_PATIENT_ID) else: Test_Msg("Test Failed for Invalid Pat_Id:"+INVALID_PATIENT_ID) Test_End() return
def test_sms_reminders_cron_bad_cron_key(self): """ Test transactions for not authorized - bad or missing cron key """ Test_Start() # We should search for this prn_info = False bad_cron_key = '123456789' empty_cron_key = '' calling_test_function = inspect.getframeinfo( inspect.currentframe().f_back)[2] if prn_info != False: print "calling:[" + calling_test_function + "]" usrname = USERNAME_NOT_TEST passwd = PASSWORD_NOT_TEST output = [] post_parameters = {} post_url = '/sms-reminders/cron/insert/' + bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 401:" + post_url) else: Test_Msg("Test Failed for 401:" + post_url) post_url = '/sms-reminders/cron/insert/' + empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 404:" + post_url) else: Test_Msg("Test Failed for 404:" + post_url) post_url = '/sms-reminders/cron/adherence-send/' + bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 401:" + post_url) else: Test_Msg("Test Failed for 401:" + post_url) post_url = '/sms-reminders/cron/adherence-send/' + empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 404:" + post_url) else: Test_Msg("Test Failed for 404:" + post_url) post_url = '/sms-reminders/cron/appointment-send/' + bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 401:" + post_url) else: Test_Msg("Test Failed for 401:" + post_url) post_url = '/sms-reminders/cron/appointment-send/' + empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 404:" + post_url) else: Test_Msg("Test Failed for 404:" + post_url) post_url = '/sms-reminders/cron/adherence-response/' + bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 401:" + post_url) else: Test_Msg("Test Failed for 401:" + post_url) post_url = '/sms-reminders/cron/adherence-response/' + empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url, post_parameters, calling_test_function, prn_info) if Access_Authorised == None: Test_Msg("Successful Test for 404:" + post_url) else: Test_Msg("Test Failed for 404:" + post_url) Test_End() return
def test_sms_reminders_cron_bad_cron_key(self): """ Test transactions for not authorized - bad or missing cron key """ Test_Start() # We should search for this prn_info = False bad_cron_key = '123456789' empty_cron_key = '' calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2] if prn_info!=False: print "calling:["+calling_test_function+"]" usrname = USERNAME_NOT_TEST passwd=PASSWORD_NOT_TEST output = [] post_parameters = {} post_url = '/sms-reminders/cron/insert/'+bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 401:"+post_url) else: Test_Msg("Test Failed for 401:"+post_url) post_url = '/sms-reminders/cron/insert/'+empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 404:"+post_url) else: Test_Msg("Test Failed for 404:"+post_url) post_url = '/sms-reminders/cron/adherence-send/'+bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 401:"+post_url) else: Test_Msg("Test Failed for 401:"+post_url) post_url = '/sms-reminders/cron/adherence-send/'+empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 404:"+post_url) else: Test_Msg("Test Failed for 404:"+post_url) post_url = '/sms-reminders/cron/appointment-send/'+bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 401:"+post_url) else: Test_Msg("Test Failed for 401:"+post_url) post_url = '/sms-reminders/cron/appointment-send/'+empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 404:"+post_url) else: Test_Msg("Test Failed for 404:"+post_url) post_url = '/sms-reminders/cron/adherence-response/'+bad_cron_key Access_Authorised = test_for_401(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 401:"+post_url) else: Test_Msg("Test Failed for 401:"+post_url) post_url = '/sms-reminders/cron/adherence-response/'+empty_cron_key Access_Authorised = test_for_404_with_get(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info ) if Access_Authorised == None: Test_Msg("Successful Test for 404:"+post_url) else: Test_Msg("Test Failed for 404:"+post_url) Test_End() return