def test_secret_error(self): res_obj = common_api.get_access_token_api('client_credential', 'wxec83eaada223a9c8', '1867d7f1cabb3bafa') self.assertEqual(res_obj.json()['errcode'], 40125, msg='验证AppSecret错误或者AppSecret不属于这个公众号')
def test_appid_error(self): res_obj = common_api.get_access_token_api( 'client_credential', 'wxec83eaada223a9', '1867d7f1cabb3bafae0b7304e8251a09') self.assertEqual(res_obj.json()['errcode'], 40013, msg='验证appid错误是否正常运行')
def test_grant_type_error(self): res_obj = common_api.get_access_token_api( 'client_creden', 'wxec83eaada223a9c8', '1867d7f1cabb3bafae0b7304e8251a09') self.assertEqual(res_obj.json()['errcode'], 40002, msg='验证grant错误是否正常运行')
def test_get_access_token(self): res_obj = common_api.get_access_token_api( 'client_credential', 'wxec83eaada223a9c8', '1867d7f1cabb3bafae0b7304e8251a09') self.assertEqual(res_obj.json()['expires_in'], 7200, msg='验证是否获取access_token值')
def test_appid_error(self): res_obj = common_api.get_access_token_api( 'client_credential', 'wx5189359b0e0ddd8', '11d4de7719a2276becf27ab573263061') self.assertEqual(res_obj.json()['errcode'], 40013)
def test_get_access_token(self): res_obj = common_api.get_access_token_api( 'client_credential', 'wx5189359b0e0ddd89', '11d4de7719a2276becf27ab573263061') self.assertEqual(res_obj.json()['expires_in'], 7200)
def test_appid_error(self): res = common_api.get_access_token_api( 'client_credential', 'wxb9013645f9c6', '8c80367d3fac3cb6d3dc910fe6416436') self.assertEqual(res.json()['errcode'], 40013)
def test_get_accesstoken(self): '''获取token测试''' #单引号 res = common_api.get_access_token_api( 'client_credential', 'wxb9013645f9c6f66b', '8c80367d3fac3cb6d3dc910fe6416436') self.assertEqual(res.json()['expires_in'], 7200)