Ejemplo n.º 1
0
 def __init__(self):
     self.cf = CommonFunction()
     # 配置文件路径
     with allure.step("获取配置文件路径"):
         file_path = "/Users/mac/auto_test/Weixin_InterfaceTest/config/config_data.yaml"
     # 获取配置文件内容
     with allure.step("获取配置文件内容"):
         self.yaml_data = self.cf.get_yaml_data(file_path)
Ejemplo n.º 2
0
 def delete_member(self, userid):
     with allure.step("获取删除成员请求参数"):
         url = self.yaml_data["contacts"]["member"]["delete_mem_url"]
         params = {"access_token": self.access_token, "userid": userid}
     logging.debug("url:" + str(url))
     logging.debug("params:" + str(params))
     with allure.step("发出删除成员的请求"):
         self.send_get(url, params=params)
Ejemplo n.º 3
0
 def update_department(self, depart_info):
     with allure.step("获取更新部门信息请求参数"):
         url = self.yaml_data["contacts"]["department"]["update_dep_url"]
         params = {"access_token": self.access_token}
     logging.debug("url:" + str(url))
     logging.debug("params:" + str(params))
     with allure.step("发出更新部门信息的请求"):
         self.send_post_json(url, depart_info, params=params)
Ejemplo n.º 4
0
 def update_member(self, update_mem_info):
     with allure.step("获取更新成员请求参数"):
         url = self.yaml_data["contacts"]["member"]["update_mem_url"]
         params = {"access_token": self.access_token}
     logging.debug("url:" + str(url))
     logging.debug("params:" + str(params))
     with allure.step("发出更新成员的请求"):
         self.send_post_json(url, update_mem_info, params=params)
Ejemplo n.º 5
0
 def delete_department(self, depa_id):
     with allure.step("获取删除部门请求参数"):
         url = self.yaml_data["contacts"]["department"]["delete_dep_url"]
         params = {"access_token": self.access_token, "id": depa_id}
     logging.debug("url:" + str(url))
     logging.debug("params:" + str(params))
     with allure.step("发出删除部门的请求"):
         self.send_get(url, params)
Ejemplo n.º 6
0
 def delete_member_many(self, useridlist):
     with allure.step("获取删除成员请求参数"):
         url = self.yaml_data["contacts"]["member"]["delete_mem_url"]
         params = {
             "access_token": self.access_token,
         }
     logging.debug("url:" + str(url))
     logging.debug("params:" + str(params))
     with allure.step("发出删除成员的请求"):
         self.send_post_json(url, useridlist, params=params)
Ejemplo n.º 7
0
 def judgment_access_token_is_valid(self, application_name, token_path):
     with allure.step("判断已经存在的yaml文件中的 access_token 是否有效"):
         url = self.yaml_data["ip_url"]
         access_token = self.cf.get_yaml_data(token_path).get(
             "access_token")
         params = {"access_token": access_token}
         res = requests.get(url, params=params)
         if res.json().get("errcode") == 40014 or res.json().get(
                 "errcode") == 41001:
             with allure.step("token 失效,重新请求"):
                 self.get_access_token(application_name)
Ejemplo n.º 8
0
 def get_department_list(self, depa_id=None):
     with allure.step("获取部门列表请求参数"):
         url = self.yaml_data["contacts"]["department"]["get_dep_list_url"]
         if depa_id:
             params = {"access_token": self.access_token, "id": depa_id}
         else:
             params = {"access_token": self.access_token}
     logging.debug("url:" + str(url))
     logging.debug("params:" + str(params))
     with allure.step("发出查询部门列表的请求"):
         self.send_get(url, params)
Ejemplo n.º 9
0
 def get_access_token(self, application_name):
     with allure.step("获取 access_token 请求参数"):
         token_url = self.yaml_data["token_url"]
         corp_id = self.yaml_data["corp_id"]
         application_secret = self.yaml_data[application_name]["secret"]
     # 构造请求参数
     with allure.step("构造获取token请求参数"):
         params = {"corpid": corp_id, "corpsecret": application_secret}
     with allure.step("发送 access_token 请求"):
         res = requests.get(token_url, params=params)
     # 获取 access_token
     with allure.step("获取 access_token"):
         access_token = res.json().get("access_token")
     # 将获取的 access_token 写入该应用专属配置文件
     with allure.step("将获取的 access_token 写入该应用专属配置文件"):
         yaml_filename = str(application_name) + "_access_token.yaml"
         content = {"access_token": access_token}
         self.cf.write_yaml(yaml_filename, content)
Ejemplo n.º 10
0
 def test_bill_amount_wrong(self):
     with helper.step("再开一单--更换处方"):
         self.sa.replace_prescription()
         time.sleep(2)
Ejemplo n.º 11
0
 def test_bill_amount_wrong(self):
     with helper.step("再开一单--订单数量为0"):
         self.sa.replace_prescription()
         time.sleep(2)
         assert self.sa.get_text(self.op.amount_tip) == '订单总额不允许为0'
Ejemplo n.º 12
0
 def test_choose_discount(self):
     with helper.step("再开一单--选择优惠"):
         self.sa.choose_discount()
         time.sleep(2)
Ejemplo n.º 13
0
 def test_login_001(self):
     with MASTER_HELPER.step("登陆CRM"):
         self.login_page.crm_login()
Ejemplo n.º 14
0
 def test_draw_a_bill(self):
     with helper.step("进入视光销售--查询用户"):
         self.op.query_users()
     with helper.step("销售开单"):
         self.op.draw_a_bill()
         time.sleep(1)
Ejemplo n.º 15
0
 def test_delete_optometry_record(self):
     with helper.step("删除验光记录"):
         self.op.delete_optometry_record()
         time.sleep(2)
Ejemplo n.º 16
0
 def test_add_optometry_record(self):
     with helper.step("新增验光记录"):
         self.lg.login()
         self.op.add_optometry_record()
         time.sleep(2)