コード例 #1
0
def test_driOffWork(driver_login_fix):

    hr, token, workstate = driver_login_fix

    if workstate:
        res = hr.request(off_work["method"], off_work["uri"])
        rj = res.json()
        assertAndNotify(rj["code"], 1, "test_driToWork", rj["msg"])
    else:
        pass
    sleep(3)
コード例 #2
0
def test_arriveHospital(doctor_login_fix):
    '''
        医生到达医院
    '''
    docHr, docToken, workState = doctor_login_fix

    res = docHr.request(arriveHospital["method"], arriveHospital["uri"])
    rj = res.json()
    print(rj)
    assertAndNotify(rj["code"], 1, "test_arriveHospital", rj["msg"])
    sleep(3)
コード例 #3
0
def test_pending(driver_login_fix):
    '''
        司机站内待命
    '''
    driHr, driToken, workState = driver_login_fix

    res = driHr.request(pending["method"], pending["uri"])
    rj = res.json()
    print(rj)
    assertAndNotify(rj["code"], 1, "test_pending", rj["msg"])
    sleep(3)
コード例 #4
0
def test_arriveSite(doctor_login_fix):
    '''
        医生到达现场
    '''
    # hr, help_id, first_dis_id = create_task_help_fix
    docHr, docToken, workState = doctor_login_fix

    res = docHr.request(arriveSite["method"], arriveSite["uri"])
    rj = res.json()
    print(rj)
    assertAndNotify(rj["code"], 1, "test_arriveSite", rj["msg"])
    sleep(3)
コード例 #5
0
def test_returnHospital(driver_login_fix):
    '''
        司机返回医院
    '''
    # hr, help_id, first_dis_id = create_task_help_fix
    driHr, driToken, workState = driver_login_fix

    res = driHr.request(returnHospital["method"], returnHospital["uri"])
    rj = res.json()
    print(rj)
    assertAndNotify(rj["code"], 1, "test_returnHospital", rj["msg"])
    sleep(3)
コード例 #6
0
def test_driToWork(driver_login_fix):

    hr, token, workstate = driver_login_fix

    if workstate:
        pass
    else:
        ambId = unit_dict["center"]["siteId"]["site1"]["ambId"][0]
        res = hr.request(to_work["method"], to_work["uri"])
        rj = res.json()
        assertAndNotify(rj["code"], 1, "test_driToWork", rj["msg"])
    sleep(3)
コード例 #7
0
def test_departure(driver_login_fix):
    '''
        司机离开现场
    '''

    # hr, help_id, fist_dis_id = create_task_help_fix
    driHr, driToken, workState = driver_login_fix

    res = driHr.request(departure["method"], departure["uri"])
    rj = res.json()
    print(rj)
    assertAndNotify(rj["code"], 1, "test_departure", rj["msg"])
    sleep(3)
コード例 #8
0
def test_accept(doctor_login_fix):
    '''
        医生接受任务
    '''

    # hr, help_id, fist_dis_id = create_task_help_fix
    docHr, docToken, workState = doctor_login_fix

    res = docHr.request(accept["method"], accept["uri"])
    rj = res.json()
    print(rj)
    assertAndNotify(rj["code"], 1, "test_accept", rj["msg"])
    sleep(3)
コード例 #9
0
ファイル: conftest.py プロジェクト: MasterKweng/autolab-fm
def admin_login_fix(http_connector_fix, cache):
    hr = http_connector_fix

    admin_token = cache.get("admin_token", None)
    if admin_token is None:
        print("no cache admin_token")
        res = hr.request(admin_login["method"], admin_login["uri"], params=admin_login["params"])
        rs = str(res)[-5:-2]
        if rs == "200":
            admin_token = res.json()["data"]["userInfo"]["token"]
            cache.set("admin_token", admin_token)
            admin_token = cache.get("admin_token", None)
        else:
            assertAndNotify(rs,"200", "admin_login_fix", rs)

    headers = {"token":admin_token}
    hr = HttpRunner(base_url=HTTPURL, verify=False, headers=headers)
    return hr, admin_token
コード例 #10
0
ファイル: conftest.py プロジェクト: MasterKweng/autolab-fm
def create_task_help_fix(agent_login_fix, cache):

    hr, token = agent_login_fix

    help_id = cache.get("help_id", 0)
    first_dispatch_id = cache.get("first_dispatch_id", 0)
    if help_id == 0 or first_dispatch_id == 0:
        print("no cahce task")
        res = hr.request(create_task_help["method"], create_task_help["uri"], params = create_task_help["params"])
        rs = str(res)[-5:-2]
        rj = res.json()
        if rs == "200" and rj["code"] == 1:
            cache.set("help_id", rj["data"]["id"])
            cache.set("first_dispatch_id", rj["data"]["dispatchId"])
            help_id = cache.get("help_id", 0)
            first_dispatch_id = cache.get("first_dispatch_id", 0)
        else:
            assertAndNotify(rs,"200", "agent_login_fix", rs)
            assertAndNotify(rj["code"], 1, "agent_login_fix", rj["msg"])

    return hr, help_id, first_dispatch_id
コード例 #11
0
ファイル: conftest.py プロジェクト: MasterKweng/autolab-fm
def agent_login_fix(http_connector_fix, cache):
    hr = http_connector_fix

    agent_token = cache.get("agent_token", None)
    if agent_token is None:
        print("no cache agent_token")
        res = hr.request(agent_login["method"], agent_login["uri"], params=agent_login["params"])
        rs = str(res)[-5:-2]
        rj = res.json()
        if rs == "200" and rj["code"] == 1:
            print(rj)
            agent_token = rj["data"]["userInfo"]["token"]
            cache.set("agent_token", agent_token)
            agent_token = cache.get("agent_token", None)
            print(agent_token)
        else:
            assertAndNotify(rs, "200", "agent_login_fix", rs)
            assertAndNotify(rj["code"], 1, "agent_login_fix", rj["msg"])

    headers = {"token":agent_token}
    hr = HttpRunner(base_url=HTTPURL, verify=False, headers=headers)
    return hr, agent_token
コード例 #12
0
ファイル: conftest.py プロジェクト: MasterKweng/autolab-fm
def driver_login_fix(http_connector_fix, cache):
    hr = http_connector_fix

    driver_token = cache.get("driver_token", None)
    if driver_token is None:
        print("no cache driver_token")
        res = hr.request(driver_login["method"], driver_login["uri"], params=driver_login["params"])
        rs = str(res)[-5:-2]
        rj = res.json()
        if rs == "200" and rj["code"] == 1:
            driver_token = res.json()["data"]["userInfo"]["token"]
            cache.set("driver_token", driver_token)
            driver_token = cache.get("driver_token", None)
        else:
            assertAndNotify(rs,"200", "agent_login_fix", rs)
            assertAndNotify(rj["code"], 1, "agent_login_fix", rj["msg"])

    headers = {"token":driver_token}
    hr = HttpRunner(base_url=HTTPURL, verify=False, headers=headers)
    res = hr.request(is_work["method"], is_work["uri"])
    workstate = res.json()["data"]

    return hr, driver_token, workstate