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
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)
Example #3
0
 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
Example #4
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()
Example #5
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()
        # dict_data['accessSign'] = accesssign
        # print(dict_data)
        print(accesssign)
        return accesssign

    # @staticmethod
    # def pushSuggestPool(id_list):
    #     url = 'https://heihei.intelcupid.com/analyzelogs'
    #     header = {
    #         'User-Agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36',
    #         'Cookie': 'zentaosid=fhbl6inr412s5afntqus7pjir6'
    #     }
    #
    #     for id in id_list:
    #         data = {
    #             "accessId": "5e9820846979ae3e53fdb0df",
    #             # "accessSign": "9985a1dbb6e0d3fbbdd15003ff83952d",
    #             "accessTime": Back_sign.location_time(),
    #             "query": "pushSuggestPool 5ecba196b7c0b83a0de91b17 " + str(id)
    #         }
    #         data["accessSign"] = Back_sign.get_sign(Back_sign.location_time())
    #         req = requests.post(url, data=data, headers=header)
    #         print(req.json())
    #         time.sleep(1)

if __name__=='__main__':
    # id_list = ['5de48f7e2782d777044c9867', '5ec5e0c0fcc88d73e190bd89','5ed627c7fd81bd313a73ba4c','5eba671303cd865537e66ed7','5dbf9cea2670af6687fbce84']
    # Backend_sign.pushSuggestPool(id_list)
    result = Backend_sign()
    result.get_sign(PublicUtils.location_time())