Ejemplo n.º 1
0
    def test_no_login_access_(self):
        """
        Test that we get a 401 - Not Authorized
        """

        Test_Start()

        Test_Msg("Trying create organization")

        # 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_NO_ACCOUNT_TEST
        passwd = PASSWORD_NO_ACCOUNT_TEST
        output = []
        post_url = '/organizations/organization/search-by-name'
        post_parameters = {}

        look_for_this = "login-box"
        print check_permission(usrname)
        # print give_permission(usrname,permission_required)
        # print check_permission(usrname)

        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 Access Test for no login:"******"Access Test Failed for no login:"******"Organization View")


        post_url = '/organizations/organization/view/1'

        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 Access Test for no_login:"******"Access Test Failed for no_login:"******"Successful Access Test for no login:"******"Access Test Failed for no_login:"+post_url)

        Test_End()

        return
Ejemplo n.º 2
0
    def test_location_access_with_no_login(self):
        """
        Try to access /location/create without login - should get a 401 - Not Authorized
        """

        Test_Start()

        prn_info = False

        usrname = USERNAME_NO_ACCOUNT_TEST
        passwd = PASSWORD_NO_ACCOUNT_TEST
        output = []
        post_url = '/location/create'
        post_parameters = {}
        look_for_this = "login-box"
        called_by = inspect.getframeinfo(inspect.currentframe().f_back)[2]

        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 - Access Failed - Not Logged in")
        else:
            Test_Msg("     Failed, got "+str(result)+" instead")

        Test_End()

        return
Ejemplo n.º 3
0
    def test_logout_for_valid_user(self):
        Test_Start()

        LOGOUT_TEST_TEXT = 'You have been logged out'

        uname = USERNAME_FOR_TEST
        pw = PASSWORD_FOR_TEST
        smc = SMSCODE_FOR_TEST
        output = []
        post_url = '/accounts/logout/'
        post_parameters = {}

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

        result = login_to_hive(uname, pw, smc)
        if result==200:
            Test_Msg("     Successful login result for: "+uname+"/"+pw+"("+smc+"):"+ str(result))
        else:
            Test_Msg("     Failed login Result - "+str(result)+" using: "+uname+"/"+pw+"("+smc+")")

        Test_Msg("Now Test Logout: "+post_url)
        outcome = test_for_200_with_get(self, uname, pw, output, post_url,post_parameters, look_for_this, calling_test_function )

        if outcome==None:
            Test_Msg("Successful Logout to "+post_url)
        Test_End()

        return
Ejemplo n.º 4
0
    def test_grouped_consent_valid_tester_valid_pat_id(self):
        '''
        Use Tester Permission. We should get the HIV Grouped Consent returned with the Pat_id
        that was loaded via fixture: intake_test_data.json
        '''
        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
        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
Ejemplo n.º 5
0
    def test_provider_view(self):
        """
        Look at a provider record
        """

        Test_Start()

        Test_Msg("Trying provider view")

        # debug print setting
        prn_info = False

        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/view/'+str(get_record)
        post_parameters = {}

        look_for_this = provider_name
        print check_permission(usrname)
        # print give_permission(usrname,permission_required)
        # print check_permission(usrname)

        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 search:"+post_url+" "+look_for_this)
        else:
            Test_Msg("Failed search:"+post_url+" "+look_for_this)



        Test_End()

        return
Ejemplo n.º 6
0
    def test_view_locator_with_valid_pat_id(self):
        """
        Access with Valid Tester Permissions and Valid pat_id
        """
        Test_Start()

        prn_info = False

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

        if prn_info!=False:
            print p

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

        if prn_info!=False:
            print "URL:" + post_url
            print "Searching for:" + 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 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
Ejemplo n.º 7
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
Ejemplo n.º 8
0
    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()
Ejemplo n.º 9
0
    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()
Ejemplo n.º 10
0
    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
Ejemplo n.º 11
0
    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
Ejemplo n.º 12
0
    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
Ejemplo n.º 13
0
    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