コード例 #1
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_quick_referral_intake_form(self):
        """
        Complete the Initial Quick Referral Intake Form with Tester Permission
        """

        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/quickreferralintake'
        post_parameters = {
                           'first_name':VALID_INPROCESS_FIRSTNAME,
                           'last_name':VALID_INPROCESS_LASTNAME,
                           }
        # look_for_this = VALID_INPROCESS_FIRSTNAME+" "+VALID_INPROCESS_LASTNAME+" ("+VALID_INPROCESS_PATIENT_ID+")"
        look_for_this = "There are errors"

        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if result == None:
            Test_Msg("Successful Test for 200 - Error Trapping:"+VALID_INPROCESS_PATIENT_ID)
        else:
            Test_Msg("Test Failed for 200 - Error Trapping:"+VALID_INPROCESS_PATIENT_ID)

        post_parameters['last_4_ssn'] = VALID_INPROCESS_LAST_4_SSN

        print post_parameters
        look_for_this = "Successfully added a new member"

        prn_info= False

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if result == None:
            Test_Msg("Successful Test for 200 - Added New Member:"+VALID_INPROCESS_PATIENT_ID)
        else:
            Test_Msg("Test Failed for 200 - Added New Member:"+VALID_INPROCESS_PATIENT_ID)


        Test_End()

        return
コード例 #2
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_mark_visit_form(self):
        """
        Complete the MarkVisit Form with Tester Permission
        """

        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/markvisit/'+VALID_PATIENT_ID
        post_parameters = {

                          }
        look_for_this = "Please fix the errors on the form"

        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if result == None:
            Test_Msg("Successful Test for 200 - Error Trapping:"+VALID_PATIENT_ID)
        else:
            Test_Msg("Test Failed for 200 - Error Trapping:"+VALID_PATIENT_ID)

        post_parameters['creation_date'] = date.today()

        print post_parameters
        look_for_this = "Successfully marked as visiting today"

        prn_info= False

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if result == None:
            Test_Msg("Successful Test for 200 - Added New Member:"+VALID_PATIENT_ID)
        else:
            Test_Msg("Test Failed for 200 - Added New Member:"+VALID_PATIENT_ID)


        Test_End()

        return
コード例 #3
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_search_valid_tester_good_name(self):
        """
        Test with Tester Permission and a good name
        """
        Test_Start()
        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/services/search-by-name'
        post_parameters = {'last_name':VALID_PATIENT_LASTNAME,
                           'first_name':VALID_PATIENT_FIRSTNAME}
        look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successful Test for Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed for Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        Test_End()

        return
コード例 #4
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_search_by_SSN_with_tester_and_invalid_ssn(self):
        """
        Successful Search with Tester Permission and Valid Search SSN
        Using testutils.test_for_200(self, usrname, passwd, output, post_url,post_parameters, looked_for, called_by )
        """
        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/search-by-ssn'
        post_parameters = {'last_4_ssn':INVALID_LAST_4_SSN}
        look_for_this = " 0 Matches For "
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        print "calling:["+calling_test_function+"]"

        Access_Authorised = test_for_200(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 200")
        else:
            Test_Msg("Test Failed for 200")

        Test_End()

        return
コード例 #5
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_search_by_SSN_with_bad_format(self):
        """
        Successful access with Tester Permission.
        Testing Bad Number formats (only 4 digits are valid)
        Test1 = 'abcd'
        Test2 = '9'
        Test3 = '99'
        Test4 = '999'
        Test5 = '99999'
        """

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/intake/search-by-ssn'
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Test_Start("Testing for invalid inputs")
        Test_input = ['abcd','9','99','999','99999']
        Test_answer = ['Enter a whole number',
                       'You must supply exactly 4 digits',
                       'You must supply exactly 4 digits',
                       'You must supply exactly 4 digits',
                       'You must supply exactly 4 digits']

        for i in range(0,5):
            Test_Msg(str(i)+":Testing "+ Test_input[i]+" for "+Test_answer[i])
            post_parameters = {'last_4_ssn':Test_input[i]}
            look_for_this = Test_answer[i]

            Access_Authorised = test_for_200(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 ("+Test_input[i]+") "+Test_answer[i])
            else:
                Test_Msg("Test Failed for ("+Test_input[i]+") "+Test_answer[i])


        Test_End("End of invalid input tests")

        return
コード例 #6
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_provider_search(self):
        """
        Do a Provider Search
        """

        Test_Start()

        Test_Msg("Trying search provider")

        # debug print setting
        prn_info = False

        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        if prn_info!=False:
            print p

        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/organizations/provider/search-by-name'
        post_parameters = {'last_name':""
        }

        look_for_this = "Match"
        print check_permission(usrname)
        # print give_permission(usrname,permission_required)
        # print check_permission(usrname)

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if Access_Authorised == None:
            Test_Msg("Successful search:"+post_url+" "+look_for_this)
        else:
            Test_Msg("Failed search:"+post_url+" "+look_for_this)



        Test_End()

        return
コード例 #7
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_search_valid_tester_bad_name(self):
        """
        Test with Tester Permission but with a name that is not found
        """
        Test_Start()
        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/services/search-by-name'
        post_parameters = {
            'last_name': INVALID_PATIENT_LASTNAME,
            'first_name': INVALID_PATIENT_FIRSTNAME
        }
        look_for_this = INVALID_PATIENT_FIRSTNAME + " " + INVALID_PATIENT_LASTNAME
        calling_test_function = inspect.getframeinfo(
            inspect.currentframe().f_back)[2]

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successful Test for Invalid Patient:" +
                     INVALID_PATIENT_FIRSTNAME + " " +
                     INVALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed for Invalid Patient:" +
                     INVALID_PATIENT_FIRSTNAME + " " +
                     INVALID_PATIENT_LASTNAME)

        Test_End()

        return
コード例 #8
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_smsreminders_send(self):
        """
        Send a text message to a cell number
        enter your cell number in TESTER_CELL_NUMBER = "999-999-9999"
        """

        Test_Start()
        # We should search for this
        prn_info = False

        calling_test_function = inspect.getframeinfo(
            inspect.currentframe().f_back)[2]
        if prn_info != False:
            print "calling:[" + calling_test_function + "]"

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/sms-reminders/send/'
        post_parameters = {
            "to": TESTER_CELL_NUMBER,
            "message": "Hello world via " + post_url
        }
        look_for_this = "SMS Sent."
        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successful Test for send message:[" +
                     post_parameters['message'] + "] to:" + TESTER_CELL_NUMBER)
        else:
            Test_Msg("Test Failed for target:" + TESTER_CELL_NUMBER)

        Test_End()

        return
コード例 #9
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_smsreminders_send(self):
        """
        Send a text message to a cell number
        enter your cell number in TESTER_CELL_NUMBER = "999-999-9999"
        """

        Test_Start()
        # We should search for this
        prn_info = False

        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/sms-reminders/send/'
        post_parameters = {"to": TESTER_CELL_NUMBER,
                           "message": "Hello world via "+post_url
                           }
        look_for_this = "SMS Sent."
        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successful Test for send message:["+post_parameters['message']+"] to:"+TESTER_CELL_NUMBER)
        else:
            Test_Msg("Test Failed for target:"+TESTER_CELL_NUMBER)

        Test_End()


        return
コード例 #10
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_sms_reminders_cron_valid_messages(self):
        """
        Load messages
        Run Cron Insert with Valid Key
        Run Cron Insert again
        """
        Test_Start()

        now = date.today()

        now_day = now.strftime("%d")
        now_month = now.strftime("%m")
        now_year  = now.strftime("%Y")

        now_to_then = now + timedelta(days=7)

        timeoday = datetime.datetime.now()
        test_time = timeoday + timedelta(minutes=10)

        now_time = test_time.strftime("%H:%M")
        now_hour = test_time.strftime("%H")
        now_minute = test_time.strftime("%M")

        then_day = now_to_then.strftime("%d")
        then_month = now_to_then.strftime("%m")
        then_year = now_to_then.strftime("%Y")

        print str(now) + "[Year:"+ now_year + " Month:"+ now_month +" Day:"+ now_day +"]"
        print str(timeoday) + "[Test time:"+ str(test_time) + "]"
        print "Valid Time for submit:"+ now_time

        prn_info = False

        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/sms-reminders/adherence/search-by-name'
        post_parameters = {"first_name": VALID_PATIENT_FIRSTNAME
                          }
        look_for_this = "Create a reminder for "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME
        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully found: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed for: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)


        post_url = '/sms-reminders/adherence/create/'+VALID_PATIENT_ID
        post_parameters = {"title": "Reminding You",
                           "creation_date_month": now_month,
                           "creation_date_day": now_day,
                           "creation_date_year": now_year,
                           "reminder_time": now_time,
                           "start_date_month": now_month,
                           "start_date_day": now_day,
                           "start_date_year": now_year,
                           "end_date_month": then_month,
                           "end_date_day": then_day,
                           "end_date_year": then_year,
                           "message": "Adherence reminders"+post_url,
                           "monday": 1,
                           "tuesday": 1,
                           "wednesday": 1,
                           "thursday": 1,
                           "friday": 1,
                           "saturday": 1,
                           "sunday": 1
                          }
        ############ Quick display
        # prn_info = True
        look_for_this = "Successfully added an adherence reminder"

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully Added Reminder: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed To Add Reminder: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        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/'+settings.CRON_KEY
        look_for_this = "The following reminders have been scheduled for today"

        prn_info = False
        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, calling_test_function, prn_info )
        if Access_Authorised == None:
            Test_Msg("Successful Test for 200:"+post_url)
        else:
            Test_Msg("Test Failed for 200:"+post_url)

        return
コード例 #11
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_create(self):
        """
        Create an organization record
        """

        Test_Start()

        Test_Msg("Trying Create Provider")

        # debug print setting
        prn_info = False

        today = datetime.today().strftime("%Y-%m-%d")
        print today

        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        if prn_info!=False:
            print p

        get_record = 1
        o = get_object_or_404(Provider, pk=get_record)
        provider_name = o.last_name
        if prn_info!=False:
            print o


        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/organizations/provider/create'
        post_parameters = {
            'first_name'    :"Hawkeye",
            'last_name'     :"Pierce",
            'slug'          :"Made up name",
            'organization'  :"4",
            'address1'      :"4077 No St",
            'city'          :"Washington",
            'state'         :"DC",
            'zip'           :"20001",
            'note'          :"Made up record - safe to delete",
            'creation_date' :today,
            }

        look_for_this = "A new provider record was created"
        print check_permission(usrname)
        # print give_permission(usrname,permission_required)
        # print check_permission(usrname)

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if Access_Authorised == None:
            Test_Msg("Successful create:"+post_url+" "+look_for_this)
        else:
            Test_Msg("Failed create:"+post_url+" "+look_for_this)



        Test_End()

        return
コード例 #12
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_HIVtest_ValidTester(self):
        """
        Do HIVTest Input and then test view-HIVTest-Result for content created in Input phase
        """
        Test_Start()

        prn_info = False

        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p
        print PatientProfile.objects.get(patient_id=VALID_PATIENT_ID)

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/hivtest/test-result/'+VALID_PATIENT_ID
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Test_Start("Testing for valid inputs")

        Test_Msg("Testing ")
        post_parameters = {'creation_date_month':'1',
                       'creation_date_day':'2',
                       'creation_date_year':'2012',
                       'cdc_form_id':'123456789',
                       'hiv_test_result':'REACTIVE',
                       'patient_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                       'worker_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                       }
        # look_for_this = "Visit Count:"
        # look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        look_for_this = '<td><a href="/hivtest/test-result/'+VALID_PATIENT_ID+'">HIV Test Result</a></td>'

        # look_for_this = '<td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">HIV Grouped Consent </a></td><td>Complete</td><td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">Redo</a>|<a href="/hivtest/view/grouped-consent/'+VALID_PATIENT_ID+'">View</a></td>'

        Access_Authorised = test_for_200(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 ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
            Test_Msg("Looked for:"+look_for_this)
        else:
            Test_Msg("Test Failed for ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)


        # print HIVTest.objects.all()


        output = []
        post_url = '/hivtest/view/test-result/'+VALID_PATIENT_ID
        post_parameters = {}
        look_for_this = VIEW_HIV_TEST_TEXT+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Access_Authorised = test_for_200_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 Valid Pat_Id:"+VALID_PATIENT_ID)
        else:
            Test_Msg("Test Failed for Valid Pat_Id:"+VALID_PATIENT_ID)

        Test_End()

        return
コード例 #13
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_grouped_consent_valid_tester_pat_id_and_input(self):
        """
        Use Tester Permission and valid pat_id submit valid input to get to clienthome page

        SELF_READ_CHOICES=(('READ-SELF','I read this myself'),
                   ("READ-WORKER", "I had this read to me."))


        creation_date*          = models.DateField(default=datetime.date.today)
        self_or_read_to*        = models.CharField(max_length=20,
                                                choices=SELF_READ_CHOICES)
        ctra_consent            = models.CharField(max_length=10, blank=True, default=None, choices=YN_CHOICES,
                                               verbose_name= "Patient Consent to Confidentital HIV Antibody Counseling, Testing, and Referral"
                                               )
        rapid_hiv_consent       = models.CharField(max_length=10, blank=True, default=None, choices=YN_CHOICES,
                                               verbose_name="Do you consent to Rapid HIV Testing?")
        rapid_hiv_verbal        = models.BooleanField(default=False, verbose_name="Verbal Agreement?")
        patient_signature*      = models.CharField(max_length=10000, blank=True)
        worker_signature*       = models.CharField(max_length=10000, blank=True)
        """

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/hivtest/grouped-consent/'+VALID_PATIENT_ID
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Test_Start("Testing for valid inputs")

        Test_Msg("Testing ")
        post_parameters = {'creation_date_month':'1',
                           'creation_date_day':'2',
                           'creation_date_year':'2012',
                           'self_or_read_to':'READ-SELF',
                           'patient_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                           'worker_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                           }
        # look_for_this = "Visit Count:"
        # look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        look_for_this = '<td><a href="/hivtest/grouped-consent/ARFT1234">HIV Grouped Consent </a></td>'

        # look_for_this = '<td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">HIV Grouped Consent </a></td><td>Complete</td><td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">Redo</a>|<a href="/hivtest/view/grouped-consent/'+VALID_PATIENT_ID+'">View</a></td>'

        Access_Authorised = test_for_200(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 ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
            Test_Msg("Looked for:"+look_for_this)
        else:
           Test_Msg("Test Failed for ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        # response=self.client.post('/clienthome/'+VALID_PATIENT_ID,post_parameters,follow=True)
        # print response
        # completed_test = '<td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">HIV Grouped Consent </a></td><td>Complete</td><td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">Redo</a>|<a href="/hivtest/view/grouped-consent/'+VALID_PATIENT_ID+'">View</a></td>'
        # updated_hivtest = self.assertContains(response, completed_test)
        # print updated_hivtest
        Test_End("End of valid input test")

        return
コード例 #14
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_RiskAssessment_ValidTester(self):
        """
        Use Tester Permission, submit valid input and then test View page
        """
        Test_Start()

        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p
        print PatientProfile.objects.get(patient_id=VALID_PATIENT_ID)

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/hivtest/risk-assessment/'+VALID_PATIENT_ID
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Test_Start("Testing for valid inputs")

        Test_Msg("Testing ")
        post_parameters = {'reason':"REQUESTING-HIV-TEST",
                           'creation_date_month':'1',
                           'creation_date_day':'2',
                           'creation_date_year':'2012',
                           'important_to_get_hiv_test':'1',
                           'should_negative_person_test':'1',
                           'ever_drug_alc_treatment':'1',
                           'important_to_get_hiv_test_after_unp_sex':'1',
                           'ever_mental_health_diagnosis':'1',
                           'mental_health_seeing_therapist':'1',
                           'mental_health_taking_medication':'1',
                           'been_incarcerated':'1',
                           'incarceration_release_date':'2012-01-01',
                           'patient_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                           'worker_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                           }
        # look_for_this = "Visit Count:"
        # look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        look_for_this = '<td><a href="/hivtest/risk-assessment/'+VALID_PATIENT_ID+'">Risk Assessment</a></td>'


        Access_Authorised = test_for_200(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 ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
            Test_Msg("Looked for:"+look_for_this)
        else:
            Test_Msg("Test Failed for ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)


        # print HIVTest.objects.all()


        output = []
        post_url = '/hivtest/view/risk-assessment/'+VALID_PATIENT_ID
        post_parameters = {}
        look_for_this = VIEW_RISK_ASSESSMENT_TEXT+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Access_Authorised = test_for_200_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 Valid Pat_Id:"+VALID_PATIENT_ID)
        else:
            Test_Msg("Test Failed for Valid Pat_Id:"+VALID_PATIENT_ID)

        Test_End()

        return
コード例 #15
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_quick_intake_with_tester(self):
        """
        Test the Quick intake form with a valid Tester Id
        """

        Test_Start("Testing Quick Intake - With Non-Tester")

        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

        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]

        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/intake/quickintake'
        post_parameters = {
                           'first_name':VALID_INPROCESS_FIRSTNAME,
                           'last_name':VALID_INPROCESS_LASTNAME,
                           'last_4_ssn':VALID_INPROCESS_LAST_4_SSN,
                           'reciept_privacy_practices': "",
                           'patient_signature':PATIENT_SIGNATURE,
                           }
        look_for = "There are errors"

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for, calling_test_function, prn_info )

        if result == None:
            Test_Msg("Successful Test for Error trapping "+post_url)
        else:
            Test_Msg("Test Failed for Error trapping"+post_url)

        post_parameters = {
                           'first_name':VALID_INPROCESS_FIRSTNAME,
                           'last_name':VALID_INPROCESS_LASTNAME,
                           'last_4_ssn':VALID_INPROCESS_LAST_4_SSN,
                           'reciept_privacy_practices': True,
                           'patient_signature':PATIENT_SIGNATURE,
                           }

        prn_info = False

        look_for = "Successfully added a new member"

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for, calling_test_function, prn_info )

        if result == None:
            Test_Msg("Successful Test for Quick Intake "+post_url +" - "+VALID_INPROCESS_FIRSTNAME+" "+VALID_INPROCESS_LASTNAME+" ("+VALID_INPROCESS_LAST_4_SSN+")")
        else:
            Test_Msg("Test Failed for Quick Intake"+post_url +" - "+VALID_INPROCESS_FIRSTNAME+" "+VALID_INPROCESS_LASTNAME+" ("+VALID_INPROCESS_LAST_4_SSN+")")


        Test_End()


        return
コード例 #16
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_initial_intake_form(self):
        """
        Complete the Initial Intake Form with Tester Permission
        """

        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/create'
        post_parameters = {'redeem_coupon':'12345',
                           'first_name':VALID_INPROCESS_FIRSTNAME,
                           'last_name':VALID_INPROCESS_LASTNAME,
                           'nick_name':'Initial',
                           'last_4_ssn':VALID_INPROCESS_LAST_4_SSN,
                           'address1':'Behind the dumpster',
                           'address2':'Branch Ave SE',
                           'city':'Washington',
                           'state':'DC',
                           'zip':'20007',
                           'county':'PG County',
                           'ward':'6',
                           'gender':'TRANSGENDER-MALE-TO-FEMALE',
                           'veteran_status': 'False',
                           'race_no_answer':'0',
                           'race_black':'0',
                           'race_white':'0',
                           'race_american_indian':'0',
                           'race_native_hawaiian_or_pac_islander':'0',
                           'race_asian':'0',
                           'race_alaskan_native':'0',
                           'race_other':'0',
                           'ethnicity':'0',
                           'health_insurance_provider':'PUBLIC-ASSIST',
                           'date_of_birth_month':'1',
                           'date_of_birth_day':'20',
                           'date_of_birth_year':'1940',
                           'home_phone_number':'999-999-9999',
                           'mobile_phone_number':'999-999-9999',
                           'patient_signature':PATIENT_SIGNATURE,
                           'reciept_privacy_practices': ""
                           }
        # look_for_this = VALID_INPROCESS_FIRSTNAME+" "+VALID_INPROCESS_LASTNAME+" ("+VALID_INPROCESS_PATIENT_ID+")"
        look_for_this = "There are errors"
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if result == None:
            Test_Msg("Successful Test for 200 - Error Trapping:"+VALID_INPROCESS_PATIENT_ID)
        else:
            Test_Msg("Test Failed for 200 - Error Trapping:"+VALID_INPROCESS_PATIENT_ID)

        post_parameters['reciept_privacy_practices'] = True

        print post_parameters
        look_for_this = "Successfully added a new member"

        prn_info= False

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if result == None:
            Test_Msg("Successful Test for 200 - Added New Member:"+VALID_INPROCESS_PATIENT_ID)
        else:
            Test_Msg("Test Failed for 200 - Added New Member:"+VALID_INPROCESS_PATIENT_ID)


        Test_Msg("Entering Phase 2 - Inprocess list")

        post_url = '/today/'
        post_parameters = {}
        look_for_this = VALID_INPROCESS_FIRSTNAME+" "+VALID_INPROCESS_LASTNAME+" ("+VALID_INPROCESS_PATIENT_ID+")"

        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if result == None:
            Test_Msg("Successful - InProcess listed:"+VALID_INPROCESS_PATIENT_ID+ " in "+post_url)
        else:
            Test_Msg("Test Failed - No inprocess List for:"+VALID_INPROCESS_PATIENT_ID+ " in "+post_url)


        Test_End()

        return
コード例 #17
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_IncentiveReceipt_ValidTester(self):
        """
        Use Tester Permission, submit valid input and then test View page
        """
        Test_Start()

        prn_info = False

        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        print PatientProfile.objects.get(patient_id=VALID_PATIENT_ID)

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/hivtest/incentive-receipt/'+VALID_PATIENT_ID
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Test_Start("Testing for valid inputs")

        Test_Msg("Testing ")
        post_parameters = {'reason':"REQUESTING-HIV-TEST",
                           'creation_date_month':'1',
                           'creation_date_day':'2',
                           'creation_date_year':'2012',
                           'incentive_amount':'10',
                           'card_number':'1234567890',
                           'patient_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                           'worker_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                           }
        # look_for_this = "Visit Count:"
        # look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        look_for_this = '<td><a href="/hivtest/incentive-receipt/'+VALID_PATIENT_ID+'">Incentive Receipt</a></td>'


        Access_Authorised = test_for_200(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 ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
            Test_Msg("Looked for:"+look_for_this)
        else:
            Test_Msg("Test Failed for ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)


        # print HIVTest.objects.all()


        output = []
        post_url = '/hivtest/view/incentive-receipt/'+VALID_PATIENT_ID
        post_parameters = {}
        look_for_this = VIEW_INCENTIVE_TEXT+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Access_Authorised = test_for_200_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 Valid Pat_Id:"+VALID_PATIENT_ID)
        else:
            Test_Msg("Test Failed for Valid Pat_Id:"+VALID_PATIENT_ID)

        Test_End()

        return
コード例 #18
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_smsreminders_adherence(self):
        """
        Search by name
        Then create appointment message

        ToDo: Get Current Date and Time and populate in to message

        """
        Test_Start()

        now = date.today()

        now_day = now.strftime("%d")
        now_month = now.strftime("%m")
        now_year  = now.strftime("%Y")

        now_to_then = now + timedelta(days=7)

        timeoday = datetime.datetime.now()
        test_time = timeoday + timedelta(minutes=10)

        now_time = test_time.strftime("%H:%M")
        now_hour = test_time.strftime("%H")
        now_minute = test_time.strftime("%M")

        then_day = now_to_then.strftime("%d")
        then_month = now_to_then.strftime("%m")
        then_year = now_to_then.strftime("%Y")

        print str(now) + "[Year:"+ now_year + " Month:"+ now_month +" Day:"+ now_day +"]"
        print str(timeoday) + "[Test time:"+ str(test_time) + "]"
        print "Valid Time for submit:"+ now_time

        # We should search for this
        prn_info = False

        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        if prn_info!=False:
            print "calling:["+calling_test_function+"]"

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/sms-reminders/adherence/search-by-name'
        post_parameters = {"first_name": VALID_PATIENT_FIRSTNAME
        }
        look_for_this = "Create a reminder for "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME
        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully found: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed for: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)


        post_url = '/sms-reminders/adherence/create/'+VALID_PATIENT_ID
        post_parameters = {"title": "Reminding You",
                           "creation_date_month": now_month,
                           "creation_date_day": now_day,
                           "creation_date_year": now_year,
                           "reminder_time": now_time,
                           "start_date_month": now_month,
                           "start_date_day": now_day,
                           "start_date_year": now_year,
                           "end_date_month": then_month,
                           "end_date_day": then_day,
                           "end_date_year": then_year,
                           "message": "Adherence reminders"+post_url,
                           "monday": 1,
                           "tuesday": 1,
                           "wednesday": 1,
                           "thursday": 1,
                           "friday": 1,
                           "saturday": 1,
                           "sunday": 1
        }
        ############ Quick display
        # prn_info = True
        look_for_this = "Successfully added an adherence reminder"

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully Added Reminder: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed To Add Reminder: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        post_url = '/sms-reminders/adherence/view/1'
        post_parameters = {}
        look_for_this = "Adherence Schedule for"

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully Viewed Reminder: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed To View Reminder: "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)



        Test_End()

        return
コード例 #19
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_create_then_view_linkage(self):
        """
        Create a Linkage then View it
        """
        Test_Start()
        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/services/search-by-name'
        post_parameters = {'last_name':VALID_PATIENT_LASTNAME,
                           'first_name':VALID_PATIENT_FIRSTNAME}
        look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 1 Worked - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 1 Failed - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        output = []
        post_url = '/services/linkage/create/'+VALID_PATIENT_ID
        post_parameters = {'service':'1',
                           'referral_type':'CLOTHING',
                           'creation_date_month':'1',
                           'creation_date_day':'5',
                           'creation_date_year':'2012',
                           'note':'Creating linkage for '+VALID_PATIENT_ID,
                           'mode_of_transportation':'AUTOMOBILE',
                           'date_of_linkage':str(date.today()),
                           'worker_signature':WORKER_SIGNATURE,
                           'patient_signature':PATIENT_SIGNATURE}


        look_for_this = "field is required"

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 2 Worked - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 2 Failed - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        post_parameters = {'service':'1',
                           'referral_type':'CLOTHING',
                           'ok_to_mail':True,
                           'creation_date_month':'1',
                           'creation_date_day':'5',
                           'creation_date_year':'2012',
                           'note':'Creating linkage for '+VALID_PATIENT_ID,
                           'mode_of_transportation':'AUTOMOBILE',
                           'date_of_linkage':str(date.today()),
                           'worker_signature':WORKER_SIGNATURE,
                           'patient_signature':PATIENT_SIGNATURE}

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 3 Worked - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 3 Failed - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        # browse past referrals
        prn_info = False

        referral_item = Referral.objects.get(pk=1)
        date_of = referral_item.creation_date
        if prn_info!=False:
            print referral_item
            print date_of

        post_url = '/services/linkage/browse-past/'+VALID_PATIENT_ID

        add_more1 = str(ServiceOrg.objects.get(pk=1))
        add_more2 = " on "
        add_more3 = str(date_of)
        add_more4 = " by "+usrname

        add_more0 = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+") was linked to "
        look_for_this = add_more0

        if prn_info!=False:
            print look_for_this

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 4 Worked - Valid Linkage:"+look_for_this)
        else:
            Test_Msg("Step 4 Failed - Valid Linkage:"+look_for_this)

        post_url = '/services/linkage/view/1'
        post_parameters = {}
        look_for_this = "Linkage View: <em>"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 5 Worked - Valid Patient/Linkage:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 5 Failed - Valid Patient/Linkage:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        Test_End()
コード例 #20
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_vgc_valid_tester(self):
        """
        Use Tester Permission. We should get the view HIV Grouped Consent returned with the Pat_id
        that was loaded via fixture: intake_test_data.json
        """
        fixtures = []
        Test_Start()

        prn_info = False

        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/hivtest/grouped-consent/'+VALID_PATIENT_ID
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Test_Start("Testing for valid inputs")

        Test_Msg("Testing ")
        post_parameters = {'reason':"REQUESTING-HIV-TEST",
                   'creation_date_month':'1',
                   'creation_date_day':'2',
                   'creation_date_year':'2012',
                   'self_or_read_to':'READ-SELF',
                   'patient_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                   'worker_signature':[{"lx":62,"ly":28,"mx":62,"my":27},{"lx":63,"ly":27,"mx":62,"my":28},{"lx":66,"ly":26,"mx":63,"my":27},{"lx":71,"ly":24,"mx":66,"my":26},{"lx":75,"ly":22,"mx":71,"my":24},{"lx":80,"ly":20,"mx":75,"my":22},{"lx":83,"ly":19,"mx":80,"my":20},{"lx":85,"ly":18,"mx":83,"my":19},{"lx":86,"ly":17,"mx":85,"my":18},{"lx":87,"ly":17,"mx":86,"my":17},{"lx":87,"ly":18,"mx":87,"my":17},{"lx":87,"ly":20,"mx":87,"my":18},{"lx":87,"ly":22,"mx":87,"my":20},{"lx":88,"ly":24,"mx":87,"my":22},{"lx":88,"ly":26,"mx":88,"my":24},{"lx":88,"ly":27,"mx":88,"my":26},{"lx":88,"ly":28,"mx":88,"my":27},{"lx":89,"ly":29,"mx":88,"my":28},{"lx":90,"ly":29,"mx":89,"my":29},{"lx":91,"ly":29,"mx":90,"my":29},{"lx":92,"ly":29,"mx":91,"my":29},{"lx":94,"ly":29,"mx":92,"my":29},{"lx":96,"ly":29,"mx":94,"my":29},{"lx":97,"ly":29,"mx":96,"my":29},{"lx":98,"ly":29,"mx":97,"my":29},{"lx":99,"ly":28,"mx":98,"my":29},{"lx":99,"ly":27,"mx":99,"my":28},{"lx":100,"ly":26,"mx":99,"my":27},{"lx":100,"ly":25,"mx":100,"my":26},{"lx":100,"ly":24,"mx":100,"my":25},{"lx":101,"ly":24,"mx":100,"my":24},{"lx":102,"ly":23,"mx":101,"my":24}],
                   }
        # look_for_this = "Visit Count:"
        # look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        look_for_this = '<a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">HIV Grouped Consent </a>'

        # look_for_this = '<td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">HIV Grouped Consent </a></td><td>Complete</td><td><a href="/hivtest/grouped-consent/'+VALID_PATIENT_ID+'">Redo</a>|<a href="/hivtest/view/grouped-consent/'+VALID_PATIENT_ID+'">View</a></td>'

        Access_Authorised = test_for_200(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 ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
            Test_Msg("Looked for:"+look_for_this)
        else:
            Test_Msg("Test Failed for ("+VALID_PATIENT_ID+") "+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)


        print HIVGroupedConsent.objects.all()

        prn_info = True

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/hivtest/view/grouped-consent/'+VALID_PATIENT_ID
        post_parameters = {}
        look_for_this = GROUPED_CONSENT_VALID_TEXT+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]
        # print "calling:["+calling_test_function+"]"

        Access_Authorised = test_for_200_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 Valid Pat_Id:"+VALID_PATIENT_ID)
        else:
            Test_Msg("Test Failed for Valid Pat_Id:"+VALID_PATIENT_ID)

        Test_End()

        return
コード例 #21
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_create_then_view_linkage(self):
        """
        Create a Linkage then View it
        """
        Test_Start()
        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/services/search-by-name'
        post_parameters = {
            'last_name': VALID_PATIENT_LASTNAME,
            'first_name': VALID_PATIENT_FIRSTNAME
        }
        look_for_this = VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME
        calling_test_function = inspect.getframeinfo(
            inspect.currentframe().f_back)[2]

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 1 Worked - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 1 Failed - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        output = []
        post_url = '/services/linkage/create/' + VALID_PATIENT_ID
        post_parameters = {
            'service': '1',
            'referral_type': 'CLOTHING',
            'creation_date_month': '1',
            'creation_date_day': '5',
            'creation_date_year': '2012',
            'note': 'Creating linkage for ' + VALID_PATIENT_ID,
            'mode_of_transportation': 'AUTOMOBILE',
            'date_of_linkage': str(date.today()),
            'worker_signature': WORKER_SIGNATURE,
            'patient_signature': PATIENT_SIGNATURE
        }

        look_for_this = "field is required"

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 2 Worked - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 2 Failed - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        post_parameters = {
            'service': '1',
            'referral_type': 'CLOTHING',
            'ok_to_mail': True,
            'creation_date_month': '1',
            'creation_date_day': '5',
            'creation_date_year': '2012',
            'note': 'Creating linkage for ' + VALID_PATIENT_ID,
            'mode_of_transportation': 'AUTOMOBILE',
            'date_of_linkage': str(date.today()),
            'worker_signature': WORKER_SIGNATURE,
            'patient_signature': PATIENT_SIGNATURE
        }

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 3 Worked - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 3 Failed - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        # browse past referrals
        prn_info = False

        referral_item = Referral.objects.get(pk=1)
        date_of = referral_item.creation_date
        if prn_info != False:
            print referral_item
            print date_of

        post_url = '/services/linkage/browse-past/' + VALID_PATIENT_ID

        add_more1 = str(ServiceOrg.objects.get(pk=1))
        add_more2 = " on "
        add_more3 = str(date_of)
        add_more4 = " by " + usrname

        add_more0 = VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME + " (" + VALID_PATIENT_ID + ") was linked to "
        look_for_this = add_more0

        if prn_info != False:
            print look_for_this

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 4 Worked - Valid Linkage:" + look_for_this)
        else:
            Test_Msg("Step 4 Failed - Valid Linkage:" + look_for_this)

        post_url = '/services/linkage/view/1'
        post_parameters = {}
        look_for_this = "Linkage View: <em>" + VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME + " (" + VALID_PATIENT_ID + ")"

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 5 Worked - Valid Patient/Linkage:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 5 Failed - Valid Patient/Linkage:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        Test_End()
コード例 #22
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_create_then_view_referral(self):
        """
        Create a Referral then View it
        """
        Test_Start()
        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        prn_info = True

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/services/search-by-name'
        post_parameters = {
            'last_name': VALID_PATIENT_LASTNAME,
            'first_name': VALID_PATIENT_FIRSTNAME
        }
        look_for_this = VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME
        calling_test_function = inspect.getframeinfo(
            inspect.currentframe().f_back)[2]

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 1 Worked - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 1 Failed - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        output = []
        post_url = '/services/referral/create/' + VALID_PATIENT_ID
        post_parameters = {
            "referral_type": "primary-care",
            "link_type": "NEW",
            "organization": "4",
            "ok_to_mail": "",
            "okay_to_call": "",
            "okay_to_leave_message": "",
            "note": "",
            "creation_date_month": datetime.today().strftime("%m"),
            "creation_date_day": datetime.today().strftime("%d"),
            "creation_date_year": datetime.today().strftime("%Y"),
        }

        Test_Msg(
            "failing due to mis match between referral type and organization")
        look_for_this = "does not provide primary-care"

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 2 Worked - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 2 Failed - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        post_parameters = {
            "referral_type": "food",
            "link_type": "NEW",
            "organization": "6",
            "ok_to_mail": "",
            "okay_to_call": "",
            "okay_to_leave_message": "",
            "note": "",
            "creation_date_month": datetime.today().strftime("%m"),
            "creation_date_day": datetime.today().strftime("%d"),
            "creation_date_year": datetime.today().strftime("%Y"),
            'worker_signature': WORKER_SIGNATURE,
        }

        look_for_this = "New referral created successfully"

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 3 Worked - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 3 Failed - Valid Patient:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        Test_End()
        Test_Start()
        # browse past referrals
        prn_info = False

        referral_item = Referral.objects.get(pk=1)
        date_of = referral_item.creation_date
        if prn_info != False:
            print referral_item
            print date_of

        post_url = '/services/referral/browse-past/' + VALID_PATIENT_ID

        add_more1 = str(ServiceOrg.objects.get(pk=1))
        add_more2 = " on "
        add_more3 = str(date_of)
        add_more4 = " by " + usrname

        add_more0 = VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME + " (" + VALID_PATIENT_ID + ") was referred to "
        look_for_this = add_more0

        if prn_info != False:
            print look_for_this

        Access_Authorised = test_for_200_with_get(
            self, usrname, passwd, output, post_url, post_parameters,
            look_for_this, calling_test_function, prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 4 Worked - Valid Referral:" + look_for_this)
        else:
            Test_Msg("Step 4 Failed - Valid Referral:" + look_for_this)

        post_url = '/services/referral/view/1'
        post_parameters = {}
        look_for_this = "Referral View: <em>" + VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME + " (" + VALID_PATIENT_ID + ")"

        Access_Authorised = test_for_200_with_get(
            self, usrname, passwd, output, post_url, post_parameters,
            look_for_this, calling_test_function, prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 5 Worked - Valid Patient/Referral:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 5 Failed - Valid Patient/Referral:" +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        Test_End()
コード例 #23
0
ファイル: tests.py プロジェクト: flowersw/millionhearts
    def test_create_then_view_referral(self):
        """
        Create a Referral then View it
        """
        Test_Start()
        # We should search for this
        p = get_object_or_404(PatientProfile, patient_id=VALID_PATIENT_ID)
        print p

        prn_info = True

        usrname = USERNAME_FOR_TEST
        passwd=PASSWORD_FOR_TEST
        output = []
        post_url = '/services/search-by-name'
        post_parameters = {'last_name':VALID_PATIENT_LASTNAME,
                           'first_name':VALID_PATIENT_FIRSTNAME}
        look_for_this = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME
        calling_test_function = inspect.getframeinfo(inspect.currentframe().f_back)[2]

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 1 Worked - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 1 Failed - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        output = []
        post_url = '/services/referral/create/'+VALID_PATIENT_ID
        post_parameters = {
                           "referral_type":"primary-care",
                           "link_type":"NEW",
                           "organization":"4",
                           "ok_to_mail":"",
                           "okay_to_call":"",
                           "okay_to_leave_message":"",
                           "note":"",
                           "creation_date_month": datetime.today().strftime("%m"),
                           "creation_date_day": datetime.today().strftime("%d"),
                           "creation_date_year":datetime.today().strftime("%Y"),

                          }

        Test_Msg("failing due to mis match between referral type and organization")
        look_for_this = "does not provide primary-care"

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised




        if Access_Authorised == None:
            Test_Msg("Step 2 Worked - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 2 Failed - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        post_parameters = {
                            "referral_type":"food",
                            "link_type":"NEW",
                            "organization":"6",
                            "ok_to_mail":"",
                            "okay_to_call":"",
                            "okay_to_leave_message":"",
                            "note":"",
                            "creation_date_month": datetime.today().strftime("%m"),
                            "creation_date_day": datetime.today().strftime("%d"),
                            "creation_date_year":datetime.today().strftime("%Y"),
                            'worker_signature':WORKER_SIGNATURE,
                           }

        look_for_this = "New referral created successfully"

        Access_Authorised = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 3 Worked - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 3 Failed - Valid Patient:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)


        Test_End()
        Test_Start()
        # browse past referrals
        prn_info = False

        referral_item = Referral.objects.get(pk=1)
        date_of = referral_item.creation_date
        if prn_info!=False:
            print referral_item
            print date_of

        post_url = '/services/referral/browse-past/'+VALID_PATIENT_ID

        add_more1 = str(ServiceOrg.objects.get(pk=1))
        add_more2 = " on "
        add_more3 = str(date_of)
        add_more4 = " by "+usrname

        add_more0 = VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+") was referred to "
        look_for_this = add_more0

        if prn_info!=False:
            print look_for_this

        Access_Authorised = test_for_200_with_get(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 4 Worked - Valid Referral:"+look_for_this)
        else:
            Test_Msg("Step 4 Failed - Valid Referral:"+look_for_this)

        post_url = '/services/referral/view/1'
        post_parameters = {}
        look_for_this = "Referral View: <em>"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME+" ("+VALID_PATIENT_ID+")"

        Access_Authorised = test_for_200_with_get(self, usrname, passwd, output, post_url,post_parameters, look_for_this, calling_test_function, prn_info )
        if prn_info!=False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Step 5 Worked - Valid Patient/Referral:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Step 5 Failed - Valid Patient/Referral:"+VALID_PATIENT_FIRSTNAME+" "+VALID_PATIENT_LASTNAME)

        Test_End()
コード例 #24
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_smsreminders_adherence(self):
        """
        Search by name
        Then create appointment message

        ToDo: Get Current Date and Time and populate in to message

        """
        Test_Start()

        now = date.today()

        now_day = now.strftime("%d")
        now_month = now.strftime("%m")
        now_year = now.strftime("%Y")

        now_to_then = now + timedelta(days=7)

        timeoday = datetime.datetime.now()
        test_time = timeoday + timedelta(minutes=10)

        now_time = test_time.strftime("%H:%M")
        now_hour = test_time.strftime("%H")
        now_minute = test_time.strftime("%M")

        then_day = now_to_then.strftime("%d")
        then_month = now_to_then.strftime("%m")
        then_year = now_to_then.strftime("%Y")

        print str(
            now
        ) + "[Year:" + now_year + " Month:" + now_month + " Day:" + now_day + "]"
        print str(timeoday) + "[Test time:" + str(test_time) + "]"
        print "Valid Time for submit:" + now_time

        # We should search for this
        prn_info = False

        calling_test_function = inspect.getframeinfo(
            inspect.currentframe().f_back)[2]
        if prn_info != False:
            print "calling:[" + calling_test_function + "]"

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/sms-reminders/adherence/search-by-name'
        post_parameters = {"first_name": VALID_PATIENT_FIRSTNAME}
        look_for_this = "Create a reminder for " + VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME
        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully found: " + VALID_PATIENT_FIRSTNAME + " " +
                     VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed for: " + VALID_PATIENT_FIRSTNAME + " " +
                     VALID_PATIENT_LASTNAME)

        post_url = '/sms-reminders/adherence/create/' + VALID_PATIENT_ID
        post_parameters = {
            "title": "Reminding You",
            "creation_date_month": now_month,
            "creation_date_day": now_day,
            "creation_date_year": now_year,
            "reminder_time": now_time,
            "start_date_month": now_month,
            "start_date_day": now_day,
            "start_date_year": now_year,
            "end_date_month": then_month,
            "end_date_day": then_day,
            "end_date_year": then_year,
            "message": "Adherence reminders" + post_url,
            "monday": 1,
            "tuesday": 1,
            "wednesday": 1,
            "thursday": 1,
            "friday": 1,
            "saturday": 1,
            "sunday": 1
        }
        ############ Quick display
        # prn_info = True
        look_for_this = "Successfully added an adherence reminder"

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully Added Reminder: " +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed To Add Reminder: " +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        post_url = '/sms-reminders/adherence/view/1'
        post_parameters = {}
        look_for_this = "Adherence Schedule for"

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully Viewed Reminder: " +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed To View Reminder: " +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        Test_End()

        return
コード例 #25
0
    def test_location_create_with_login(self):
        """
        Access with valid login account.
        Create a new location.
        Check for return to home page.
        """
        Test_Start()

        prn_info = False

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/location/create'
        post_parameters = {'address1':'9876 Branch Ave SE',
                           'city':'Washington',
                           'state':'DC',
                           'zip':'20003',
                           'submit':'Save',
                           'ward':'6'
                           }

        # look_for_this = "9876 Branch Ave SE  DC, 20003 (Ward:6)"
        #            <span>9876 Branch Ave SE  DC, 20003 (Ward:6)</span>

        look_for_this = HOME_PAGE_TITLE_TEXT
        called_by = inspect.getframeinfo(inspect.currentframe().f_back)[2]


        result = test_for_200(self, usrname, passwd, output, post_url,post_parameters, look_for_this, called_by, prn_info )
        if result==None:
            Test_Msg("     Successful Test - Location Created: "+look_for_this)
        else:
            Test_Msg("     Failed, got "+str(result)+" instead")

        # now recheck the create page to see if location was added.
        post_parameters = {}
        look_for_this = "9876 Branch Ave SE  DC, 20003 (Ward:6)"

        result = test_for_200_with_get(self, usrname, passwd, output, post_url,post_parameters, look_for_this, called_by, prn_info )
        if result==None:
            Test_Msg("     Successful Test - Location Created: "+look_for_this)
        else:
            Test_Msg("     Failed, got "+str(result)+" instead")


        # Select a location
        post_url = '/location/select'
        post_parameters = {'locations':'2',
                           'submit':'Update',
                           'action':'/location/select'
                           }
        look_for_this = "<span>Sumner Rd. &amp; Martin Luther King Jr. Ave  SE  DC, 20004 (Ward:8)</span>"


        Test_Msg("Testing for Location Select:" + look_for_this)

        result2 = test_for_200(self,usrname,passwd,output,post_url,post_parameters,look_for_this, called_by, prn_info)
        if result2==None:
            Test_Msg("     Successful Test - selected:"+look_for_this)
        else:
            Test_Msg("     Failed, got "+str(result2)+" instead")

        Test_Msg()

        if prn_info!=False:
            print "List of Locations:"
            print LocationSetup.objects.all()

        return
コード例 #26
0
ファイル: tests.py プロジェクト: videntity/millionhearts
    def test_sms_reminders_cron_valid_messages(self):
        """
        Load messages
        Run Cron Insert with Valid Key
        Run Cron Insert again
        """
        Test_Start()

        now = date.today()

        now_day = now.strftime("%d")
        now_month = now.strftime("%m")
        now_year = now.strftime("%Y")

        now_to_then = now + timedelta(days=7)

        timeoday = datetime.datetime.now()
        test_time = timeoday + timedelta(minutes=10)

        now_time = test_time.strftime("%H:%M")
        now_hour = test_time.strftime("%H")
        now_minute = test_time.strftime("%M")

        then_day = now_to_then.strftime("%d")
        then_month = now_to_then.strftime("%m")
        then_year = now_to_then.strftime("%Y")

        print str(
            now
        ) + "[Year:" + now_year + " Month:" + now_month + " Day:" + now_day + "]"
        print str(timeoday) + "[Test time:" + str(test_time) + "]"
        print "Valid Time for submit:" + now_time

        prn_info = False

        calling_test_function = inspect.getframeinfo(
            inspect.currentframe().f_back)[2]
        if prn_info != False:
            print "calling:[" + calling_test_function + "]"

        usrname = USERNAME_FOR_TEST
        passwd = PASSWORD_FOR_TEST
        output = []
        post_url = '/sms-reminders/adherence/search-by-name'
        post_parameters = {"first_name": VALID_PATIENT_FIRSTNAME}
        look_for_this = "Create a reminder for " + VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME
        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully found: " + VALID_PATIENT_FIRSTNAME + " " +
                     VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed for: " + VALID_PATIENT_FIRSTNAME + " " +
                     VALID_PATIENT_LASTNAME)

        post_url = '/sms-reminders/adherence/create/' + VALID_PATIENT_ID
        post_parameters = {
            "title": "Reminding You",
            "creation_date_month": now_month,
            "creation_date_day": now_day,
            "creation_date_year": now_year,
            "reminder_time": now_time,
            "start_date_month": now_month,
            "start_date_day": now_day,
            "start_date_year": now_year,
            "end_date_month": then_month,
            "end_date_day": then_day,
            "end_date_year": then_year,
            "message": "Adherence reminders" + post_url,
            "monday": 1,
            "tuesday": 1,
            "wednesday": 1,
            "thursday": 1,
            "friday": 1,
            "saturday": 1,
            "sunday": 1
        }
        ############ Quick display
        # prn_info = True
        look_for_this = "Successfully added an adherence reminder"

        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         look_for_this, calling_test_function,
                                         prn_info)
        if prn_info != False:
            print "Access Authorised:"
            print Access_Authorised

        if Access_Authorised == None:
            Test_Msg("Successfully Added Reminder: " +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)
        else:
            Test_Msg("Test Failed To Add Reminder: " +
                     VALID_PATIENT_FIRSTNAME + " " + VALID_PATIENT_LASTNAME)

        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/' + settings.CRON_KEY
        look_for_this = "The following reminders have been scheduled for today"

        prn_info = False
        Access_Authorised = test_for_200(self, usrname, passwd, output,
                                         post_url, post_parameters,
                                         calling_test_function, prn_info)
        if Access_Authorised == None:
            Test_Msg("Successful Test for 200:" + post_url)
        else:
            Test_Msg("Test Failed for 200:" + post_url)

        return