def test_ivr_balance(): uac = SippClient(script="uac_g711_info1.xml", target="localhost", command="-m 1") clientProc = SippClient.launch(uac) time.sleep(15) # at this point, make sure the client completed try: outs, errs = clientProc.communicate(input="q", timeout=10) except TimeoutExpired: clientProc.kill() outs, errs = clientProc.communicate() print(outs) print(errs) pytest.fail('problem with sipp client') found_balance = False fh = None try: fh = open("transaction.log", encoding="utf8") for lino, line in enumerate(fh, start=1): line = line.rstrip() if line.find("ivr") > -1: found_balance = True break except EnvironmentError as err: pytest.fail('problem with transaction log') finally: if fh is not None: fh.close() assert found_balance == True
def test_run_1_call(self): """The setUp will launch server, make and launch client to run 1 call, report 1 successful call.""" pc = SippClient(target="localhost", command="-m 1") sipp_client_proc = SippClient.launch(pc) time.sleep(12) # at this point, try: outs, errs = sipp_client_proc.communicate(input="q", timeout=10) except TimeoutExpired: sipp_client_proc.kill() outs, errs = sipp_client_proc.communicate() assert how_many_success(pc.script, pc.pid) == 1 cleanup_screen_log(pc.script, pc.pid)
def test_run_3_cps(self): """The setUp will launch server, make and launch client to run 30 calls at 3 calls per second, report 30 successful calls.""" pc = SippClient(command="-r 3 -m 30") sipp_client_proc = SippClient.launch(pc) time.sleep(15) # at this point, try: outs, errs = sipp_client_proc.communicate(input = "q", timeout = 10) except TimeoutExpired: sipp_client_proc.kill() outs.errs = sipp_client_proc.communicate() self.assertTrue(how_many_success(pc.script, pc.pid) == 30) cleanup_screen_log(pc.script, pc.pid)
def get_balance_client(): logging.info("Attempting IVR balance inquiry") uac = SippClient(script="uac_g711_info1.xml", target="127.0.0.1", command="-m 1") clientProc = SippClient.launch(uac) time.sleep(15) # at this point, make sure the client completed try: outs, errs = clientProc.communicate(input="q", timeout=10) except TimeoutExpired: clientProc.kill() outs, errs = clientProc.communicate() print(outs) print(errs) return
def test_create_default_client(): """Create a default SippClient object, do we get the expected data in the object?""" p = SippClient() assert p.script == "uac.xml" assert p.port == "6060" assert p.command == "" assert p.pid == 0 assert p.target == "127.0.0.1" assert p.rport == "5060"
def test_run_3_cps(self): """The setUp will launch server, make and launch client to run 30 calls at 3 calls per second, report 30 successful calls.""" pc = SippClient(target="localhost", command="-r 3 -m 30") sipp_client_proc = SippClient.launch(pc) time.sleep(15) # at this point, try: outs, errs = sipp_client_proc.communicate(input="q", timeout=10) except TimeoutExpired: sipp_client_proc.kill() outs, errs = sipp_client_proc.communicate() #print(outs) #print(errs) #pytest.fail('problem stopping sipp client') assert how_many_success(pc.script, pc.pid) == 30 cleanup_screen_log(pc.script, pc.pid)