Example #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)
 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)
 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)
 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)
 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)
 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)
Example #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)
 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)
Example #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)
Example #10
0
 def test_bill_amount_wrong(self):
     with helper.step("再开一单--更换处方"):
         self.sa.replace_prescription()
         time.sleep(2)
Example #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'
Example #12
0
 def test_choose_discount(self):
     with helper.step("再开一单--选择优惠"):
         self.sa.choose_discount()
         time.sleep(2)
Example #13
0
 def test_login_001(self):
     with MASTER_HELPER.step("登陆CRM"):
         self.login_page.crm_login()
Example #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)
Example #15
0
 def test_delete_optometry_record(self):
     with helper.step("删除验光记录"):
         self.op.delete_optometry_record()
         time.sleep(2)
Example #16
0
 def test_add_optometry_record(self):
     with helper.step("新增验光记录"):
         self.lg.login()
         self.op.add_optometry_record()
         time.sleep(2)