コード例 #1
0
    def test_startflash(self):
        '''
        startflash接口用例
        '''

        url = ReadConfig().get_host('online_host') + ReadConfig().get_path(
            'app_path') + 'v1/startflash'

        header = {'Content-Type': 'application/json;charset=UTF-8'}

        data = {
            "accessId": self.accessId,
            "accessTime": self.accesstime,
            "location": [116.428268432617, 39.918750762939]
        }

        data['accessSign'] = App_sign().get_sign(data)
        # print(data)
        allure.attach(json.dumps(data), '接口数据', allure.attachment_type.JSON)

        resq = requests.post(url, data=json.dumps(data), headers=header)
        # print(resq.json())
        # # try:
        assert resq.status_code == 200
        assert resq.json()['success'] == True
        assert 'flashProfile' in resq.json()
        allure.attach(json.dumps(resq.json(), ensure_ascii=False), "响应",
                      allure.attachment_type.JSON)
コード例 #2
0
 def test_stopflash(self):
     '''
     stopflash接口用例
     '''
     url = ReadConfig().get_host('online_host') + ReadConfig().get_path(
         'app_path') + 'v1/stopflash'
     header = {'Content-Type': 'application/json;charset=UTF-8'}
     data = {'accessId': self.accessId, 'accessTime': self.accesstime}
     data['accessSign'] = App_sign().get_sign(data)
     resq = requests.post(url, data=json.dumps(data), headers=header)
     assert resq.status_code == 200
     assert resq.json()['success'] == True
     allure.attach(json.dumps(resq.json(), ensure_ascii=False), "响应",
                   allure.attachment_type.JSON)
コード例 #3
0
def get_musicpid():
    accessId = ReadConfig().get_accessid('accessId')
    accesstime = PublicUtils().location_time()
    url = ReadConfig().get_host('online_host') + ReadConfig().get_path(
        'app_path') + 'v1/userposts'
    header = {'Content-Type': 'application/json;charset=UTF-8'}
    get_data = {
        'accessId': accessId,
        'uid': accessId,
        'accessTime': accesstime
    }
    get_data['accessSign'] = App_sign().get_sign(get_data)
    resq = requests.post(url, data=json.dumps(get_data), headers=header)
    # print(resq.json())
    return resq.json()
コード例 #4
0
 def seedmessage(str):
     get_url = ReadConfig()
     # url = 'https://open.feishu.cn/open-apis/bot/hook/e0033765c2804225a64d02f0e9483634'
     url = get_url.get_url('lark_url')
     headers = {
         'Content-Type': 'application/json',
     }
     data = {
         "msgtype": "text",
         "title": "新包上传成功了,点击下方链接进行下载",
         "text": str
     }
     resq = requests.post(url, data=json.dumps(data), headers=headers)
     if resq.status_code == 200 and resq.json()['ok'] != False:
         # print(resq.json())
         print('消息发送成功')
     else:
         print('发送失败errcode{}'.format(resq.json()))
コード例 #5
0
class Backend_sign:
    def __init__(self):
        self.read = ReadConfig()

    def get_sign(self, sign_time):
        #加密方式
        backend_login_token = self.read.get_token('banckend_login')
        accesssign = PublicUtils.hash_body(backend_login_token + str(sign_time))
        # dict_data['accessSign'] = accesssign
        # print(dict_data)
        print(accesssign)
        return accesssign
コード例 #6
0
class Test_startstopflash:
    accessId = ReadConfig().get_accessid('accessId')
    accesstime = PublicUtils().location_time()

    @allure.feature('飞行闪聊')
    @allure.story('点击启程数据返回正常')
    @allure.severity('blocker')
    def test_startflash(self):
        '''
        startflash接口用例
        '''

        url = ReadConfig().get_host('online_host') + ReadConfig().get_path(
            'app_path') + 'v1/startflash'

        header = {'Content-Type': 'application/json;charset=UTF-8'}

        data = {
            "accessId": self.accessId,
            "accessTime": self.accesstime,
            "location": [116.428268432617, 39.918750762939]
        }

        data['accessSign'] = App_sign().get_sign(data)
        # print(data)
        allure.attach(json.dumps(data), '接口数据', allure.attachment_type.JSON)

        resq = requests.post(url, data=json.dumps(data), headers=header)
        # print(resq.json())
        # # try:
        assert resq.status_code == 200
        assert resq.json()['success'] == True
        assert 'flashProfile' in resq.json()
        allure.attach(json.dumps(resq.json(), ensure_ascii=False), "响应",
                      allure.attachment_type.JSON)

    def test_stopflash(self):
        '''
        stopflash接口用例
        '''
        url = ReadConfig().get_host('online_host') + ReadConfig().get_path(
            'app_path') + 'v1/stopflash'
        header = {'Content-Type': 'application/json;charset=UTF-8'}
        data = {'accessId': self.accessId, 'accessTime': self.accesstime}
        data['accessSign'] = App_sign().get_sign(data)
        resq = requests.post(url, data=json.dumps(data), headers=header)
        assert resq.status_code == 200
        assert resq.json()['success'] == True
        allure.attach(json.dumps(resq.json(), ensure_ascii=False), "响应",
                      allure.attachment_type.JSON)
コード例 #7
0
class App_sign:
    def __init__(self):
        self.read = ReadConfig()

    def get_sign(self, dict_data):
        # dict_data['accessTime'] = Create_sign.location_time()
        # print(dict_data)
        accesssign = ''
        for key in sorted(dict_data):
            accesssign += xxxx + 'xxxx' + xxxxx + xxxx
        # print(accesssign)
        # print(type(accesssign))
        #加密方式
        app_login_token = self.read.get_token('app_login')
        accesssign = PublicUtils.hash_body(accesssign + app_login_token)
        # dict_data['accessSign'] = accesssign
        # print(dict_data)
        # print(accesssign)
        return accesssign
コード例 #8
0
 def setup_class(self):
     self.accessId = ReadConfig().get_accessid('accessId')
     self.url = ReadConfig().get_host('online_host') + ReadConfig(
     ).get_path('app_path') + 'v1/searchhobbies'
     self.accesstime = PublicUtils().location_time()
コード例 #9
0
 def __init__(self):
     self.read = ReadConfig()