提交 7ad86ba0 authored 作者: 张孟夏's avatar 张孟夏

提交token接口

上级
*** Settings ***
Library RequestsLibrary
*** Variables ***
${kfz} api_tester # 开发者账号
${kfz2} api_tester2 # 开发者账号2
${zh} api_test_admin # 租管账号
${tenant_code} API_test # 租户号
${sa} superAdmin # superAdmin账号
*** Test Cases ***
token生成
Create Session URL http://accounts-4j.sit.ninetechone.com
${content} 生成token ${kfz} $SM4$Nd/e40vIS6UD9VMaSOmYGlrBORfo7r5/1z9D5d4E4es=$4MS$ ${tenant_code} #加密后的密码
Set Global Variable ${a_token} ${content["access_token"]} #开发者access_token
Set Global Variable ${token} Bearer ${content["access_token"]} #开发者token
${content} 生成token ${kfz2} $SM4$Nd/e40vIS6UD9VMaSOmYGlrBORfo7r5/1z9D5d4E4es=$4MS$ ${tenant_code} #加密后的密码
Set Global Variable ${token2} Bearer ${content["access_token"]} #开发者token
${content} 生成token ${zh} $SM4$Nd/e40vIS6UD9VMaSOmYGlrBORfo7r5/1z9D5d4E4es=$4MS$ ${tenant_code} #加密后的密码
Set Global Variable ${zh_token} Bearer ${content["access_token"]} #租户管理员token
${content} 生成超管token ${sa} $SM4$tWWLyDEfYmpphWp4pM8ZUb1BubcyuHXfi2nrklSy27w=$4MS$ #加密后的密码
Set Global Variable ${sa_token} Bearer ${content["access_token"]} #超级管理员token
[Teardown] Delete All Sessions
*** Keywords ***
生成token
[Arguments] ${un} ${pw} ${tenant_code}
${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Sm4-Key=dUVNkTJLlzMHPqBTZh085jT0N6S7930l6sgddJsYSC8= Cookie=ENCRYPT_KEY=f48bf3-05fe-4978
${data} Evaluate json.loads('{"username":"${un}","password":"${pw}","tenantCode":"${tenant_code}","scope":"all","client_id":"a68ad587830d41aebf418a919006353e","client_secret":"Ninetech@123","grant_type":"password"}') json
${resp} post On Session URL /oauth/token params=${data} headers=${header}
${content} Set Variable ${resp.json()}
[Return] ${content}
生成超管token
[Arguments] ${un} ${pw}
${header} Create Dictionary Content-Type=application/x-www-form-urlencoded Sm4-Key=Qf7bSeptgg80KfKUhoCCZZeeVGm+L5CN1KL4S1fPyhQ=
${params} Evaluate json.loads('{"username":"${un}","password":"${pw}","scope":"all","client_id":"a68ad587830d41aebf418a919006353e","client_secret":"Ninetech@123","grant_type":"password"}') json
${resp} post On Session URL /oauth/token params=${params} headers=${header}
${content} Set Variable ${resp.json()}
[Return] ${content}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论