def demo_screen_man(test_suite_details): testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: vista = test_driver.connect_VistA(test_suite_details) rc = RCActions(vista, user=TestHelper.fetch_access_code(test_suite_details, testname), code=TestHelper.fetch_verify_code(test_suite_details, testname)) rc.signon() vista.wait('Select TERMINAL TYPE NAME:') vista.write('') vista.wait('Select Clinician Menu Option:') vista.write('OE') vista.wait('Select Patient: Change View') vista.write('FD') vista.wait('Select PATIENT NAME:') vista.write('0849') #0849 vista.wait('Select: Next Screen') vista.write('Q') vista.wait('Select Patient: Change View') vista.write('^') vista.wait('Select Clinician Menu Option:') rc.signoff() test_driver.post_test_run(test_suite_details) except TestHelper.TestError, e: test_driver.exception_handling(test_suite_details, e)
def test_01_CreateInitialScheme(self): self.dbConnect() self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='bet' ), "Error: Table bet not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='scheme' ), "Error: Table scheme not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='options' ), "Error: Table options not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='scheme_option_summary' ), "Error: Table scheme_option_summary not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='bonus' ), "Error: Table bonus not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='bet_archive' ), "Error: Table bet_archive not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='options_archive' ), "Error: Table options_archive not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='schemearchive' ), "Error: Table schemearchive not found" ) self.assertTrue(TestHelper.checkTableExists(conn=self.conn, sch_str='public', table_str='finalizebet' ), "Error: Table finalizebet not found" )
def test_02_checkSchemeTable(self): self.dbConnect() try: self.startServer() rows = TestHelper.checkSchemeTable(conn=self.conn, scheme_name='s3', options=2, total=0) self.assertTrue(len(rows)==1, "Error: no rows not found" ) self.stopServer() except Exception as e: self.assertTrue( False, "Error: %s" % str(e) )
def stopmon(test_suite_details): '''This stops the Coverage Monitor''' testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: VistA1 = test_driver.connect_VistA(test_suite_details) path = (test_suite_details.result_dir + '/' + TestHelper.timeStamped('ADT_coverage.txt')) VistA1.stopCoverage(path, test_suite_details.coverage_type) test_driver.post_test_run(test_suite_details) except TestHelper.TestError, e: test_driver.exception_handling(test_suite_details, e)
def dive_into_menus(test_suite_details): testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: vista = test_driver.connect_VistA(test_suite_details) rc = RCActions(vista, user=TestHelper.fetch_access_code(test_suite_details, testname), code=TestHelper.fetch_verify_code(test_suite_details, testname)) rc.signon() vista.wait('Select Training Menu Option:') vista.write('OE') vista.wait('Select CPRS Manager Menu Option:') vista.write('CL') vista.wait('Select Clinician Menu Option:') vista.write('RR') vista.wait('Select Patient:') #vista.write('0089') #vista.wait('CHOOSE 1-2:') #vista.write('1') #vista.wait('Select Item(s):') #vista.write('1') #vista.wait('Select Health Summary Type:') vista.write('^') vista.wait(':') vista.write('^') vista.wait(':') vista.write('^') vista.wait(':') rc.signoff() test_driver.post_test_run(test_suite_details) except TestHelper.TestError, e: test_driver.exception_handling(test_suite_details, e)
def test_updates_categories_based_on_predictions(self): TestHelper.assertCallParameter(self.UpdateTestData.data, self.UpdateService.call, 0)
def pl_test017(resultlog, result_dir, namespace): '''This test creates Problem Selection List, but does not delete the lists upon completion such that global files can be compared post-testing.''' testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: VistA1 = test_driver.connect_VistA(test_suite_details) pl = PLActions(VistA1) pl.signon() pl.createsellist(listname="List001", clinic='VISTA') pl.createcat(listname='List001', catname='cat001') pl.createcat(listname='List001', catname='cat002') pl.createcat(listname='List001', catname='cat003') pl.catad(listname='List001', catname='cat001', icd='785.2', snomed='75431008', spec='General', dtext='', seqnum='5') pl.catad(listname='List001', catname='cat001', icd='786.50', snomed='29857009', spec='General', dtext='', seqnum='1') pl.catad(listname='List001', catname='cat001', icd='786.2', snomed='49727002', spec='General', dtext='PAINFUL cough', seqnum='2') pl.catad(listname='List001', catname='cat001', icd='786.05', snomed='267036007', spec='General', dtext='Trouble Breathing', seqnum='7') pl.catad(listname='List001', catname='cat002', icd='829.0', snomed='125605004', spec='N', dtext='', seqnum='19') pl.catad(listname='List001', catname='cat002', icd='807.00', snomed='60667009', spec='N', dtext='', seqnum='18') pl.catad(listname='List001', catname='cat002', icd='806.12', snomed='21978005', spec='N', dtext='', seqnum='17') pl.catad(listname='List001', catname='cat002', icd='829.1', snomed='1370007', spec='N', dtext='', seqnum='16') pl.catad(listname='List001', catname='cat002', icd='802.8', snomed='430984009', spec='N', dtext='', seqnum='15') pl.catad(listname='List001', catname='cat003', icd='780.50', snomed='53888004', spec='I', dtext='', seqnum='3') pl.catad(listname='List001', catname='cat003', icd='292.0', snomed='363101005', spec='I', dtext='DRUG withdrawal', seqnum='1') pl.catad(listname='List001', catname='cat003', icd='304.90', snomed='191816009', spec='I', dtext='', seqnum='2') pl.sellistad(listname='List001', catname='cat001', hdrname='FATCAT', seqnum='7') pl.sellistad(listname='List001', catname='cat002', hdrname='SKINNYcat', seqnum='1') pl.sellistad(listname='List001', catname='cat003', hdrname='blackCAT', seqnum='5') pl.signoff() except TestHelper.TestError, e: resultlog.write(e.value) logging.error(testname + ' EXCEPTION ERROR: Unexpected test result')
def do_request(self, method, url, **kwargs): return TestHelper.do_request( method=method, url=url, **kwargs )
addtocart.addToCartProductPageMethod() except NoSuchElementException, e: print "Click button [Add to Cart] on product page" else: break checkout = TestHelper.CheckoutPage(self.driver) # while True: # try: # checkout.addtoWishlistCheckoutElement() # except NoSuchElementException: # print "Click [Add to Wishlist] button" # else: # break # if checkout.checkwishlistCheckout: # if (checkout.checkwishlistCheckout.text == 1): # print "Wishlist"+checkout.checkwishlistCheckout.text+"Product is Added to Wishlist" # else: # print "Product is not added to Wishlist - Fail" while True: try: checkout.addNewPaymentCheckout() except WebDriverException, e: print "Unable to click Add Payment in Checkout, retrying" else: break checkoutAddress = TestHelper.AddAddressCheckout(self.driver) checkoutAddress.credit_card_checkout() checkoutAddress.addAddressIcon() checkoutAddress.add_address_checkout() checkoutAddress.addAddressCheckoutPayment()
def test_fit_uses_train_values(self): self.assertEqual(self.AiTestData.TRAIN_VALUES, TestHelper.callArgument(self.model.fit, 0))
def sc_test010(test_suite_details): ''' This test makes appointments and saves demographics ''' testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: VistA = test_driver.connect_VistA(test_suite_details) SC = SCActions(VistA, scheduling='Scheduling') time = SC.schtime() # this signon() and fix_demographics() is a workaround for gtm bug if not (os.environ.get('gtm_zquit_anyway') == "1") and (VistA.type == 'GTM'): SC.signon() SC.fix_demographics(clinic='CLInicA', patient='323123456', dgrph=[['COUNTRY', ''], ['STREET ADDRESS', ''], ['ZIP', '20005'], ['CITY', 'WASHINGTON'], ['PHONE NUMBER', ''], ['PHONE NUMBER', ''], ['BAD ADDRESS INDICATOR', ''], ['save the above changes', 'yes']]) # SC.signon() tclinic = SC.getclinic() SC.set_demographics(clinic='CLInicA', patient='323123456', dgrph=[['COUNTRY', ''], ['STREET ADDRESS', '123 SMITH STREET'], ['STREET ADDRESS', ''], ['ZIP', '20005'], ['CITY', 'WASHINGTON'], ['PHONE NUMBER', '2021112222'], ['PHONE NUMBER', ''], ['BAD ADDRESS INDICATOR', ''], ['save the above changes', 'yes'], ['Press ENTER to continue', ''], ['SEX', 'MALE'] , ['Select ETHNICITY', 'N'], ['Select RACE', 'Black'], ['new RACE INFORMATION', 'Yes'], ['RACE', ''], ['MARITAL STATUS', 'MARRIED'], ['RELIGIOUS PREFERENCE', 'CELTICISM'], ['TEMPORARY ADDRESS ACTIVE', 'NO'], ['PHONE NUMBER', ''], ['PAGER NUMBER', ''], ['EMAIL ADDRESS', '']]) SC.signon() SC.get_demographics(patient='323123456', vlist=[['COUNTRY: UNITED STATES', ''], ['123 SMITH STREET', ''], ['STREET ADDRESS', ''], ['20005', ''], ['CITY: WASHINGTON', ''], ['2021112222', ''], ['PHONE NUMBER', ''], ['BAD ADDRESS INDICATOR', ''], ['save the above changes', 'no'], ['Press ENTER to continue', ''], ['SEX: MALE', ''], ['Select ETHNICITY INFORMATION: NOT HISPANIC OR LATINO', ''], ['ETHNICITY: NOT HISPANIC OR LATINO', ''], ['Select RACE INFORMATION: BLACK OR AFRICAN AMERICAN', ''], ['RACE: BLACK OR AFRICAN AMERICAN', ''], ['Select RACE INFORMATION', ''], ['MARITAL STATUS', 'MARRIED'], ['RELIGIOUS PREFERENCE: CELTICISM', ''], ['ADDRESS ACTIVE', ''], ['PHONE NUMBER', ''], ['PAGER NUMBER', ''], ['EMAIL ADDRESS', '']]) SC.signoff() test_driver.post_test_run(test_suite_details) except TestHelper.TestError, e: test_driver.exception_handling(test_suite_details, e)
def test_04_checkSchemeTable(self): self.dbConnect() rows = TestHelper.checkSchemeTable(conn=self.conn, scheme_name='s3', options=2, total=0) self.assertTrue(len(rows)==1, "Error: no rows not found" )
def test_checks_the_accuracy_of_the_built_modell(self): TestHelper.assertCallParameter(self.AiTestData.ACCURACY, self.AccuracyCheckService.call, 0)
def test_prepareOptionsToOffer_displays_categories(self): TestHelper.assertCallParameter(self.UpdateTestData.categories[3], self.OptionDisplayService.call, 2)
def test_askUserForChoice_displays_prompt(self): TestHelper.assertCallParameter(self.UiTestData.PROMPT, self.mockedInput, 0)
def test_prepareOptionsToOffer_displays_probability(self): TestHelper.assertCallParameter(self.UpdateTestData.data.problemValues[0][2], self.OptionDisplayService.call, 1)
def test_prepareOptionsToOffer_displays_choice_key(self): TestHelper.assertCallParameter(self.UpdateTestData.resultKeys[0], self.OptionDisplayService.call, 0)
def test_fit_uses_train_results(self): self.assertEqual(self.AiTestData.TRAIN_RESULTS, TestHelper.callArgument(self.model.fit, 1))
def IntersectionCountHash(arr1, arr2): count = 0 d1 = {} for i in arr1: d1[i] = 1 for j in arr2: if j in d1: count += 1 return count a1 = TestHelper.GenerateRandomIntListWithoutDuplicates(50000, 0, 1000000) a2 = TestHelper.GenerateRandomIntListWithoutDuplicates(40000, 0, 1000000) print("solution 1") t1 = datetime.now() count = IntersectionCount(a1, a2) t2 = datetime.now() print("IntersectionCount", count, "Time diff", t2 - t1) print("solution 2") t1 = datetime.now() count = IntersectionCountSorted(a1, a2)
if c in charDict: # if index saved in dict less than value in minDuplicateIndex update it duplicateFound = True if minDuplicateIndex > charDict[c]: minDuplicateIndex = charDict[c] elif not duplicateFound: # otherwise if minDuplicateIndex not assigned add current char to dict charDict[c] = index if duplicateFound: return s[minDuplicateIndex] return "No duplicate" def GetFirstDuplicate(s): # Create empty dict charDict = {} # loop on string for c in s: # check if char exist in dict return it if c in charDict: return c charDict[c] = True # otherwise add it return "No duplicate" m = TestHelper.GenerateRandomString(20, CharType.Uppercase) print(m, " First duplicate ", GetFirstDuplicate(m)) print(m, " First index ", GetFirstDuplicateIndex(m))
from selenium import webdriver import TestHelper import time from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys test = TestHelper.Test() driver = webdriver.Chrome() loginUrl = "http://172.16.168.205:9021/login.aspx" indexUrl = "http://172.16.168.205:9021/index.aspx" def S(selector): return driver.find_element_by_css_selector(selector) def login(): driver.get(loginUrl) S("#userName").send_keys("zjm") S("#pwd").send_keys("zjm") S("#btn").click() def loginTest(): #正确用户名密码登录 driver.get(loginUrl) time.sleep(1) S("#userName").send_keys("zxl") S("#pwd").send_keys("zxl") S("#btn").click() time.sleep(3)
def test_uses_the_row_number_to_update_rows(self): TestHelper.assertFunctionParametersAcrossAllcalls( range(len(self.UpdateTestData.data.problemResults)), self.handleOneRowArgs, 0)
def test_addToPlan(self): p,e = TestHelper.createPlan(self,"ERE") step_list = p.step_list self.assertEqual(step_list[0].start,Plan.STANDARD_START) self.assertEqual(step_list[1].start,CalcTime.addTime(Plan.STANDARD_START,step_list[0].duration)) self.assertEqual(step_list[2].start,CalcTime.addTime(step_list[1].start,step_list[1].duration))
def test_countNodes_just_root(self): solution = Solution() self.assertEqual(1, solution.countNodes(TestHelper.generateTree([1])))
def setUp(self): with\ Autowired('DataTestData', self),\ MockedService('keras.Sequential') as self.model: self.result = neuralNetBuilderService().call(self.DataTestData.MAX_LENGTH, self.DataTestData.OUTPUT_NEURONS ) self.firstCallList = TestHelper.callArgument(self.model, 0)
def do_request(self, method, url, data=None): return TestHelper.do_request(method, url, data)
firstTerm = temp # return secondTerm def Fibonacci_recursive(number): cache = {} def fib(number): # base case fpr 1 & 0 if number in [0, 1]: return number # recursive case if not number in cache: cache[number] = fib(number - 1) + fib(number - 2) return cache[number] return fib(number) intList = TestHelper.GenerateRandomIntListWithoutDuplicates(5, 1, 60) for i in intList: t1 = datetime.now() r = Fibonacci_iterative(i) t2 = datetime.now() print(i, "Fibonacci_iterative", r, t2 - t1) t1 = datetime.now() r = Fibonacci_recursive(i) t2 = datetime.now() print(i, "Fibonacci_recursive", r, t2 - t1)
import TestHelper def selectionSort(arr): # loop over the input for i in range(len(arr)): # define var for minimum location minLoc = i # loop over the input again to find min location for j in range(i, len(arr)): if arr[j] < arr[minLoc]: minLoc = j # swap i with minimum location arr[minLoc], arr[i] = arr[i], arr[minLoc] a = TestHelper.GenerateRandomIntList(20) print(a) selectionSort(a) print(a)
import TestHelper import MergeSort import QuickSort import heapSort from time import time l = TestHelper.CreateRandomIntList(100000, 10, 9000000) lc = list(l) t0 = time() qck = QuickSort.QuickSort(l) t1 = time() s = MergeSort.MergeSort(l) t2 = time() heapSort.heapSort(lc) t3 = time() print((l[99], s[99])) print((l[99], qck[99])) print((l[99], lc[99])) print('function vers1 takes %f' % (t1 - t0)) print('function vers2 takes %f' % (t2 - t1)) print('function vers3 takes %f' % (t3 - t2))
def pl_test004(test_suite_details): ''' This test creates a Problem Selection List, and then adds/modifies/removes categories and problems ''' testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: VistA1 = test_driver.connect_VistA(test_suite_details) pl = PLActions(VistA1) pl.signon() pl.createsellist(listname="List001", clinic='VISTA') pl.createcat(listname='List001', catname='cat001') pl.createcat(listname='List001', catname='cat002') pl.catad(listname='List001', catname='cat001', icd='787.1', snomed='16331000') pl.catad(listname='List001', catname='cat001', icd='786.50', snomed='29857009') pl.catad(listname='List001', catname='cat001', icd='100.0', snomed='77377001') pl.catad(listname='List001', catname='cat002', icd='780.50', snomed='53888004') pl.catad(listname='List001', catname='cat002', icd='292.0', snomed='363101005') pl.catad(listname='List001', catname='cat002', icd='304.90', snomed='191816009') pl.sellistad(listname='List001', catname='cat001') pl.sellistad(listname='List001', catname='cat002') pl.versellist(ssn='656454321', clinic='VISTA', vlist=[ 'List001', 'cat001', 'Heartburn', '[Cc]hest pain', 'Leptospirosis', 'cat002', 'Disturbance', '[Dd]rug withdrawal', '[Dd]rug dependence' ]) pl.addbyprobnum(ssn='656454321', clinic='VISTA', probnum='1', comment='this is a test', onsetdate='t', status='Active', acutechronic='A', service='N', evalue='Heartburn') pl.verify(ssn='656454321', probnum='1', itemnum='1', evalue=['Heartburn']) pl.rem(ssn='656454321') pl.sellistrm(listname='List001') pl.sellistrm(listname='List001') pl.catdl(listname='List001', catname='cat001') pl.catdl(listname='List001', catname='cat002') pl.sellistrfu(listname='List001', username='******') pl.sellistdl(listname='List001', clinic='VISTA') # Even deletion caused this part to fail, more information is needed pl.checkRMsellist(ssn='656454321', clinic='VISTA') pl.signoff() test_driver.post_test_run(test_suite_details) except TestHelper.TestError, e: test_driver.exception_handling(test_suite_details, e)
def test_executes_SQL_TO_OBTAIN_CATEGORIES(self): self.fakeConnection.cursor.execute.assert_called_once() TestHelper.assertCallParameter(config.SQL_TO_OBTAIN_CATEGORIES, self.fakeConnection.cursor.execute, 0)
def pl_test005(test_suite_details): '''This test creates a Problem Selection List, assigns it to user, and adds problem. ''' '''This test uses separate VistA Instances to allow concurrent connections in case of future use of tstart and trollback when these features are available.''' testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: test_driver.testname = testname + '_01' VistA1 = test_driver.connect_VistA(test_suite_details) pl1 = PLActions(VistA1) pl1.signon() pl1.createsellist(listname="List002", clinic='') pl1.sellistgal(listname="List002", username='******') pl1.createcat(listname='List002', catname='cat011') pl1.createcat(listname='List002', catname='cat022') pl1.catad(listname='List002', catname='cat011', icd='787.1', snomed='16331000') pl1.catad(listname='List002', catname='cat011', icd='786.50', snomed='29857009') pl1.catad(listname='List002', catname='cat011', icd='100.0', snomed='77377001') pl1.catad(listname='List002', catname='cat022', icd='780.50', snomed='53888004') pl1.catad(listname='List002', catname='cat022', icd='292.0', snomed='363101005') pl1.catad(listname='List002', catname='cat022', icd='304.90', snomed='191816009') pl1.sellistad(listname='List002', catname='cat011') pl1.sellistad(listname='List002', catname='cat022') test_driver.testname = testname + '_02' VistA2 = test_driver.connect_VistA(test_suite_details) pl2 = PLActions(VistA2, user='******', code='1Doc!@#$') pl2.signon() pl2.versellist(ssn='354623902', clinic='', vlist=[ 'List002', 'cat011', 'Heartburn', '[Cc]hest pain', 'Leptospirosis', 'cat022', 'Disturbance', '[Dd]rug withdrawal', '[Dd]rug dependence' ]) pl2.addbyprobnum(ssn='354623902', clinic='', probnum='1', comment='this is a test', onsetdate='t', status='Active', acutechronic='A', service='N', evalue='Heartburn') pl2.verify(ssn='354623902', probnum='1', itemnum='1', evalue=['Heartburn']) pl2.rem(ssn='354623902') pl1.sellistrm(listname='List002') pl1.sellistrm(listname='List002') pl1.catdl(listname='List002', catname='cat011') pl1.catdl(listname='List002', catname='cat022') pl1.sellistrfu(listname='List002', username='******') pl1.sellistdl(listname='List002', clinic='') pl2.signoff() pl1.signoff() test_driver.post_test_run(test_suite_details) except TestHelper.TestError, e: test_driver.exception_handling(test_suite_details, e)
def check_params_match(self, port, portList): """Generic test for checking params listed in the /constraints endpoint are listed in in the /staged and /active endpoints""" for myPort in portList: rDest = "single/" + port + "/" + myPort + "/constraints/" sDest = "single/" + port + "/" + myPort + "/staged/" aDest = "single/" + port + "/" + myPort + "/active/" r_valid, r_response = self.checkCleanRequestJSON("GET", rDest) s_valid, s_response = self.checkCleanRequestJSON("GET", sDest) a_valid, a_response = self.checkCleanRequestJSON("GET", aDest) count = 0 amsg = "Expected an array to be returned {} but got {}".format( rDest, r_response) omsg = "Expected array entries to be dictionaries at {} but got {}".format( rDest, r_response) # Check the response is a list if r_valid: if s_valid: if a_valid: if isinstance(r_response, list): if len(r_response) > 0: for entry in r_response: if isinstance(entry, dict): constraintParams = entry.keys() try: stagedParams = s_response[ 'transport_params'][ count].keys() except AttributeError: # Found something that we couldn't get keys from, not a dict then... return False, "Staged parameters contain non-dicts in array position " \ "{}".format(count) except KeyError: return False, "Staged parameters do not contain transport_params" try: activeParams = a_response[ 'transport_params'][ count].keys() except AttributeError: # Found something that we couldn't get keys from, not a dict then... return False, "Active parameters contain non-dicts in array position " \ "{}".format(count) except KeyError: return False, "Active parameters do not contain transport_params" smsg = "Staged parameter set does not match parameters in constraints" amsg = "Active parameter set does not match parameters in constraints" if len(r_response) == len( s_response['transport_params'] ): pass else: return False, "Number of legs differs between staged and constraints" if len(r_response) == len( a_response['transport_params'] ): pass else: return False, "Number of legs differs between active and constraints" if TestHelper.compare_json( constraintParams, stagedParams): pass else: return False, smsg if TestHelper.compare_json( constraintParams, activeParams): pass else: return False, amsg count = count + 1 else: return False, omsg else: return False, "Not tested. No resources found." else: return False, amsg else: return False, a_response else: return False, s_response else: return False, r_response return True, ""
def pl_test012(test_suite_details): '''This test performs Problem List Menu Testing (pseudo smoke test)''' testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: test_driver.testname = testname + '_01' VistA1 = test_driver.connect_VistA(test_suite_details) pl = PLActions(VistA1, user='******', code='1Doc!@#$') pl.signon() pl.addcsv(ssn='656451234', pfile='./Functional/dataFiles/probdata0.csv') pl.detview( ssn='656451234', probnum='2', vlist1=['ACTIVE', 'ALEXANDER', '444.21', 'I74.2', '54687002'], vlist2=['hurts']) pl.rem(ssn='656451234') pl.rem(ssn='656451234') pl.checkempty(ssn='656451234') pl.signoff() test_driver.testname = testname + '_02' VistA2 = test_driver.connect_VistA(test_suite_details) p2 = PLActions(VistA2, user='******', code='1Cle!@#$') p2.signon() p2.dataentry(ssn='656451234', provider='Alexander', clinic='', problem='305.91', comment='Test', onsetdate='t', status='a', acutechronic='A', service='n') p2.signoff() test_driver.testname = testname + '_03' VistA3 = test_driver.connect_VistA(test_suite_details) p3 = PLActions(VistA3, user='******', code='1Doc!@#$') p3.signon() p3.verifyproblem(ssn='656451234', problem='305.91') p3.add(ssn='656451234', clinic='Clinic1', comment='this is a test', onsetdate='t', status='Active', acutechronic='A', service='N', icd='786.2', icd10='R05', snomed='49727002', verchknum='2') p3.signoff() test_driver.testname = testname + '_04' VistA4 = test_driver.connect_VistA(test_suite_details) p4 = PLActions(VistA4, user='******', code='1Doc!@#$') p4.signon() p4.selectnewpatient(ssn1='656451234', name1='SIX,', ss2='323123456', name2='NINE,') p4.signoff() test_driver.testname = testname + '_05' VistA5 = test_driver.connect_VistA(test_suite_details) p5 = PLActions(VistA5, user='******', code='1Doc!@#$') p5.signon() p5.addcsv(ssn='656451234', pfile='./Functional/dataFiles/probdata0.csv') p5.printproblemlist(ssn='656451234', vlist=['PROBLEM LIST', '305.91']) p5.signoff() test_driver.post_test_run(test_suite_details) except TestHelper.TestError, e: test_driver.exception_handling(test_suite_details, e)
def addPatient(VistA, pfile): '''Add ALL patients from specified CSV ''' preader = TestHelper.CSVFileReader() prec = preader.getfiledata(pfile, 'key') for pitem in prec: VistA.write('S DUZ=1 D ^XUP') VistA.wait('Select OPTION NAME') VistA.write('Core Applications\r') VistA.wait("Core Applications") VistA.write("ADT Manager Menu") index = VistA.multiwait(['to continue', 'Select ADT Manager Menu']) if index == 0: VistA.write('') VistA.wait('ADT Manager Menu') VistA.write("Registration Menu\r") VistA.wait("Registration Menu") VistA.write('Register a Patient') index = VistA.multiwait(['PATIENT NAME', "Select 1010 printer"]) if index == 1: VistA.write("NULL") VistA.wait('PATIENT NAME') VistA.write(prec[pitem]['fullname'].rstrip().lstrip()) index = VistA.multiwait(['ARE YOU ADDING', 'Enterprise Search']) VistA.write('Y') if index == 1: while True: index = VistA.multiwait([ 'FAMILY', 'GIVEN', 'MIDDLE NAME', 'PREFIX', 'SUFFIX', 'DEGREE', 'SOCIAL SECURITY', 'DATE OF BIRTH', 'SEX', 'MAIDEN NAME', 'CITY', 'STATE', 'MULTIPLE BIRTH', 'PHONE NUMBER', 'ARE YOU ADDING' ]) if index == 14: VistA.write('Y') break elif index == 6: VistA.write(pitem) elif index == 7: VistA.write(prec[pitem]['dob'].rstrip().lstrip()) elif index == 8: VistA.write(prec[pitem]['sex'].rstrip().lstrip()) else: VistA.write('') VistA.wait('to continue') VistA.write('') VistA.wait('MULTIPLE BIRTH INDICATOR') VistA.write('') VistA.wait('MAIDEN NAME:') VistA.write('') else: VistA.wait('SEX') VistA.write(prec[pitem]['sex'].rstrip().lstrip()) VistA.wait('DATE OF BIRTH') VistA.write(prec[pitem]['dob'].rstrip().lstrip()) VistA.wait('SOCIAL SECURITY NUMBER') VistA.write(pitem) VistA.wait('TYPE') VistA.write(prec[pitem]['type'].rstrip().lstrip()) VistA.wait('PATIENT VETERAN') VistA.write(prec[pitem]['veteran'].rstrip().lstrip()) VistA.wait('SERVICE CONNECTED') VistA.write(prec[pitem]['service'].rstrip().lstrip()) VistA.wait('MULTIPLE BIRTH INDICATOR') VistA.write(prec[pitem]['twin'].rstrip().lstrip()) index = VistA.multiwait(["Do you still", 'FAMILY']) if index == 0: VistA.write('Y') VistA.wait("FAMILY") VistA.write('^\r') VistA.wait('MAIDEN NAME:') VistA.write('') VistA.wait('[CITY]') VistA.write(prec[pitem]['cityob'].rstrip().lstrip()) VistA.wait('[STATE]') VistA.write(prec[pitem]['stateob'].rstrip().lstrip()) VistA.wait('ALIAS') VistA.write('') searchArray = ['exit:', VistA.prompt] if VistA.type == 'cache': searchArray.append(VistA.namespace) index = VistA.multiwait(searchArray) if index == 0: VistA.write('\r') VistA.wait('Patient Data') VistA.write('Y') VistA.wait('QUIT') VistA.write('4') VistA.wait('COUNTRY') VistA.write('') VistA.wait('STREET ADDRESS') VistA.write('834 Ocean Vista Avenue\r') VistA.wait('ZIP') VistA.write('90401') VistA.wait('CITY') VistA.write('1') VistA.wait('PHONE NUMBER') VistA.write('310-555-2233\r\r') VistA.wait('changes') VistA.write('Y\r') VistA.wait('QUIT') VistA.write('\r\r') VistA.wait('QUIT') VistA.write('1') VistA.wait('PRIMARY NOK') VistA.write('Carter,David J Sr') VistA.wait('RELATIONSHIP') VistA.write('FATHER') VistA.wait('ADDRESS') VistA.write('Y') VistA.wait('WORK PHONE') VistA.write('310-555-9876\r^') VistA.wait('condition') VistA.write('N') VistA.wait('today') VistA.write('Y') VistA.wait('Registration login') VistA.write('NOW') VistA.wait(PROMPT)
def pl_test016(resultlog, result_dir, namespace): '''This tests the PL Site Parameters menu''' testname = sys._getframe().f_code.co_name test_driver = TestHelper.TestDriver(testname) test_driver.pre_test_run(test_suite_details) try: VistA1 = test_driver.connect_VistA(test_suite_details) pl = PLActions(VistA1, user='******', code='1Doc!@#$') pl.signon() # check verify pl setting pl.editPLsite(ver='no', prompt='no', uselex='yes', order='CHRONO', screendups='yes') pl.checkVerplsetting(ssn='656451234') # check lexicon pl setting and prompt setting pl.editPLsite(ver='yes', prompt='no', uselex='no', order='CHRONO', screendups='yes') pl.addspec(ssn='656451234', clinic='Clinic1', comment='this is a test', onsetdate='t-1', status='Active', acutechronic='A', service='N', icd='785.2', prompt='no', uselex='no', screendups='yes', isdup='no') # check chronology pl setting pl.addspec(ssn='656451234', clinic='Clinic1', comment='this is a test', onsetdate='t', status='Active', acutechronic='A', service='N', icd='786.2', prompt='no', uselex='no', screendups='yes', isdup='no') pl.verplist(ssn='656451234', vlist=['785.2', '786.2']) pl.editPLsite(ver='yes', prompt='yes', uselex='yes', order='REVERSE', screendups='yes') pl.addspec(ssn='656451234', clinic='Clinic1', comment='this is a test', onsetdate='t', status='Active', acutechronic='A', service='N', icd='787.1', prompt='yes', uselex='yes', screendups='yes', isdup='no', vlist=['Heartburn', '785.2', '786.2']) # check that re-adding a problem is detected properly pl.editPLsite(ver='yes', prompt='yes', uselex='yes', order='REVERSE', screendups='yes') pl.addspec(ssn='656451234', clinic='Clinic1', comment='this is a test', onsetdate='t', status='Active', acutechronic='A', service='N', icd='787.1', prompt='yes', uselex='yes', screendups='yes', isdup='yes', prob='Heartburn') pl.signoff() except TestHelper.TestError, e: resultlog.write(e.value) logging.error(testname + ' EXCEPTION ERROR: Unexpected test result')