Exemplo n.º 1
0
def test_listMedicationsForDiagnosis():
    diagnosis = "Ebola"
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))
    assert adm.listMedicationsForDiagnosis(diagnosis) == True

    diagnosis = "DoesNotExist"
    assert adm.listMedicationsForDiagnosis(diagnosis) == False
Exemplo n.º 2
0
def test_listDrugAmtForEachCategory(capsys):
    start = "2015-01-11 19:50:32"
    end = "2015-01-13 19:50:32"
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))
    adm.listDrugAmtForEachCategory(start, end)
    out=capsys.readouterr()
    print (out)
    assert out[0] == 'Report Part 1: Drug Amount Prescribed For Each Category Between 2015-01-11 19:50:32 and 2015-01-13 19:50:32\n-----------------------\n- category: anti-Ebola\n- drug_name: ZMapp\n- amount: 8\n-------------------------------------------------\nReport Part 2: Total Amount Prescribed For Each Category Between 2015-01-11 19:50:32 and 2015-01-13 19:50:32\n-----------------------\n- category: anti-Ebola\n- total: 8\n'
Exemplo n.º 3
0
def test_listDrugAmtForEachDoctor(capsys):
    start = "2015-01-11 19:50:32"
    end = "2015-01-13 19:50:32"
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))
    adm.listDrugAmtForEachDoctor(start, end)
    out=capsys.readouterr()
    print (out)
    assert out[0] == 'Report: Drug Amount Prescribed For Each Doctor Between 2015-01-11 19:50:32 and 2015-01-13 19:50:32:\n-----------------------\n- drug_name: Retrovir\n- DoctorName: Mehmet Oz\n- total_amount: 85\n-----------------------\n- drug_name: Viread\n- DoctorName: Phil McGraw\n- total_amount: 16\n'
Exemplo n.º 4
0
def test_classes_Admin_listDiagnosesMadeBeforePrescribingDrug(): 
    '''
    classes.Admin.listDiagnosesMadeBeforePrescribingDrug(self, drug_name):
        print 'Report: Diagnoses Made Before Prescribing ' + drug_name
        result = listDiagnosesMadeBeforePrescribingDrug(drug_name)
        for idx, row in enumerate(result):
            print '-----------------------'
            printRow(row)
        if result != None:
            return True
        else:
            return False
    '''
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))
    # if there are diagnoses before drug
    assert adm.listDiagnosesMadeBeforePrescribingDrug("ZMapp") == True
    # if there are no diagnoses before drug
    assert adm.listDiagnosesMadeBeforePrescribingDrug("Heroin") == False
Exemplo n.º 5
0
def test_classes_Admin_listMedicationsForDiagnosis(): 
    '''
    classes.Admin.listMedicationsForDiagnosis(self, diagnosis):
        print 'Report: Drugs Prescribed to Treat ' + diagnosis
        result = listMedicationsForDiagnosis(diagnosis)
        for idx, row in enumerate(result):
            print '-----------------------'
            printRow(row)
        if result != None:
            return True
        else:
            return False
    '''
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))
    # if there are medications for diagnosis
    assert adm.listMedicationsForDiagnosis('Ebola') == True

    # if there are no medications for diagnosis
    assert adm.listMedicationsForDiagnosis('DoesNotExdgfsgdfsist') == False
Exemplo n.º 6
0
def test_admin_listMedicationsForDiagnosisFlow(capsys):
    '''
    admin.listMedicationsForDiagnosisFlow(adm):
        diagnosis = raw_input("Which diagnosis would you like to search? ")
        if not adm.listMedicationsForDiagnosis(diagnosis):
            print("That diagnosis is not in the database")
    '''
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))
    # if there are medications for diagnosis
    admfile.listMedicationsForDiagnosisFlow(adm)
    out=capsys.readouterr()
    assert out[0] == ''
    
    # if there are medications for diagnosis
    db_wipe()
    admfile.listMedicationsForDiagnosisFlow(adm)
    out=capsys.readouterr()
    assert out[0] == 'That diagnosis is not in the database'
Exemplo n.º 7
0
def test_admin_listDiagnosisesForDrugFlow(capsys):
    '''
    admin.listDiagnosisesForDrugFlow(adm):
        drug = raw_input("Which drug would you like to search? ")
        if not adm.listDiagnosesMadeBeforePrescribingDrug(drug):
            print("That drug is not in the database")
    '''
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))

    # if there are diagnosis for drug
    admfile.listMedicationsForDiagnosisFlow(adm)
    out=capsys.readouterr()
    assert out[0] == ''

    # if there are no diagnosis for drug
    db_wipe()
    admfile.listMedicationsForDiagnosisFlow(adm)
    out=capsys.readouterr()
    assert out[0] == 'That drug is not in the database'
Exemplo n.º 8
0
def test_listDiagnosesMadeBeforePrescribingDrug():
    drug_name = "ZMapp"
    adm = AdminStaff(db.getUser('Lgtkejq', 'sygtv{'))
    assert adm.listDiagnosesMadeBeforePrescribingDrug(drug_name) == True
    drug_name = "Heroin"
    assert adm.listDiagnosesMadeBeforePrescribingDrug(drug_name) == False