Exemple #1
0
"""此文件为gmall的PC端巡店逻辑所有 接口测试文件"""
import unittest
import requests
import json
import os
import random
from time import sleep
from interfaceTest.GMALL.gmall_header import host, get_header_pc
from interfaceTest.GMALL.gmall_all.color import out_format
from interfaceTest.GMALL.public_files import user_id, user_id_01
from urllib3 import encode_multipart_formdata
from datetime import datetime, timedelta

header, token1 = get_header_pc("admin_sylvia", "admin1")
header_xun, token2 = get_header_pc("admin80473", "admin@123")
header_zheng, token3 = get_header_pc("admin38796", "admin@123")


def Problem_list():
    """问题分类--列表
    :param:parent_id:父级id,非必填
    """
    url = host + "/api/company/patrol-issues"
    r = requests.get(url=url, headers=header).json()
    out_format("问题分类-列表:", r)
    problem_third_id = r["data"]["issues"][0]["children"][0]["children"][0]["id"]
    print("problem_third_id:", problem_third_id)
    return problem_third_id


problem_third_id = Problem_list()
Exemple #2
0
import unittest
import requests
import json
import os
from time import sleep
import datetime
from interfaceTest.GMALL.gmall_header import get_header_pc
from interfaceTest.GMALL.rounding_off import round_up
from urllib3 import encode_multipart_formdata
# from gmall_creatnum import camera

host, header, token = get_header_pc()

# capita = camera()
"""2.2.3经营分析、客流/交流测试脚本---正常场景"""


class Passenger_flow(object):
    def dailyRangeShopStats(self):
        """本门店统计(每天)连续多日---下面的顾客人数的接口需要调用该接口计算出日期选择范围内的顾客总人数"""
        url_00 = host + "/api/shops/%s/daily-range-stats" % 25
        data = {"start_date": "2019-01-18", "end_date": "2019-01-20"}
        r_00 = requests.get(url=url_00, headers=header, params=data).json()
        # self.assertEqual(r_00["code"], 0)
        print("本门店统计(每天)连续多日:", r_00, "\n")
        s = len(r_00["data"]["stats"])
        print(s)
        sum = 0  # 先把sum赋值=0
        for i in range(s):
            customer_num = r_00["data"]["stats"][i]["customer_num"]
            # print(customer_num)
Exemple #3
0
import requests
import json
from interfaceTest.GMALL.gmall_header import host, get_header_pc
from interfaceTest.GMALL.gmall_all.color import out_format
from interfaceTest.GMALL.public_files import user_id, user_id_01
import random

header, token1 = get_header_pc("admin_sylvia", "admin1")

# def account_list():
#     """账号列表"""
#     # account_list = []
#     url = host + "/api/user?page="
#     r = requests.get(url=url, headers=header).json()
#     # s = r["data"]["users"]["data"]
#     if r["data"]["users"]["data"] is not None:
#         user_id = r["data"]["users"]["data"][-1]["id"]  # 巡查人
#         user_id_01 = r["data"]["users"]["data"][-2]["id"]   # 整改人
#         user_name = r["data"]["users"]["data"][-1]["username"]
#         # account_list.append(user_id)
#         print("获取user_id[%s]:" % user_id, "\n")
#         print("获取username[%s]:" % user_name, "\n")
#         out_format("账号列表:", r)
#         return user_id, user_id_01, user_name
#     else:
#         print("data is null")
#         out_format("账号列表:", r)
#         return None
#
#
# account_list()
Exemple #4
0
import requests
from interfaceTest.GMALL.gmall_header import host, golbal_shopid, get_header_pc
from interfaceTest.GMALL.gmall_all.color import out_format
import random

header, token1 = get_header_pc()
# 此文件为公共调用的文件

# def guide_list(shop_id=golbal_shopid):
#     """导购-列表
#     :param:shop:门店id
#     :param:page_size 分页条数(非必填)
#     :param:page 页码(默认1)(非必填)
#     """
#     guide_id_list = []
#     url = host + "/api/shops/%s/salemans" % shop_id
#     r = requests.get(url=url, headers=header).json()
#     if r["data"]["salemans"]["data"] is not None:
#         s = len(r["data"]["salemans"]["data"])
#         print("长度:", s)
#         for i in range(s):
#             guide_id_list.append(r["data"]["salemans"]["data"][i]["id"])
#             for index, guide_id in enumerate(guide_id_list, 1):
#                 print("获取导购id[%s]:" % index, r["data"]["salemans"]["data"][i]["id"], "\n")
#                 out_format("导购列表:", r)
#                 return guide_id
#     else:
#         print("data is null")
#         print("导购列表", r, "\n")
#     return None
#