Browse Source

Merge pull request '登录时判断获取token' (#23) from test into master

Reviewed-on: http://git.qniao.cn/automated-test-scripts/yyt-trading-rf-api/pulls/23
master
梁金满 4 years ago
parent
commit
30c546bff0
27 changed files with 124 additions and 146 deletions
  1. 7
      001_login_get_info/login_customer.robot
  2. 5
      001_login_get_info/login_supplier.robot
  3. 58
      003_enterprise_open_account_customer/printing_packaging_factory_open_account.robot
  4. 56
      004_enterprise_open_account_supplier/supplier_paper_open_account.robot
  5. 1
      005_enterprise_apply_credit/apply_credit_qniao_customer.robot
  6. 58
      006_get_credit/customer_credit_password.robot
  7. 1
      006_get_credit/customer_get_credit.robot
  8. 1
      007_paper_variety_management/paper_brand.robot
  9. 1
      007_paper_variety_management/paper_category.robot
  10. 1
      007_paper_variety_management/paper_manufacturer.robot
  11. 1
      008_market_information/market_information_link.robot
  12. 1
      009_product_manage/product_add_and_list.robot
  13. 1
      010_limited_specialoffer/limited_specialoffer_product.robot
  14. 1
      011_product_price_config/product_price_config_qniao_and_feisuan.robot
  15. 1
      012_product_price_update/product_price_batch_update_purchaseprice.robot
  16. 1
      013_paper_list_and_details/customer_get_paper_list_and_detail.robot
  17. 1
      014_shinpping_address/customer_enterprise_shipping_address.robot
  18. 1
      015_customer_create_order/customer_create_order_credit_payment.robot
  19. 1
      016_enquiry_create_order/customer_enquiry_operate_and_supplier_quoted_price_create_order.robot
  20. 65
      017_order_and_receipt_and_delivery/get_oeder_and_receipt_and_delivery.robot
  21. 1
      018_payable_and_receivable/customer_bill.robot
  22. 1
      018_payable_and_receivable/payable.robot
  23. 1
      018_payable_and_receivable/receivable.robot
  24. 1
      019_capacity_market/capacity_commodity.robot
  25. 1
      019_capacity_market/capacity_machines.robot
  26. 1
      100_test_data_clear.robot
  27. 1
      __init__.robot

7
001_login_get_info/login_customer.robot

@ -57,12 +57,13 @@ customer_login_token
Log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
#Should Be Equal As Strings successful ${response.json()["message"]}
${getlogintoken_customer} Get From Dictionary ${response.json()} data
log ${getlogintoken_customer}
${get_status} ${token} Run Keyword And Ignore Error Get From Dictionary ${response.json()} data
${getlogintoken_customer} Set Variable If "${get_status}"=="FAIL" ${gettoken_customer}
... "${token}"=="None" ${gettoken_customer} ${token}
#全局token
Set Global Variable ${getlogintoken_customer}
#&{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer}
&{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${gettoken_customer}
&{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer}
Set Suite Variable ${cloudfactory_customer_header}
get_customer_userinfo

5
001_login_get_info/login_supplier.robot

@ -57,8 +57,9 @@ supplier_login_token
Log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
#Should Be Equal As Strings successful ${response.json()["message"]}
${getlogintoken_supplier} Get From Dictionary ${response.json()} data
log ${getlogintoken_supplier}
${get_status} ${token} Run Keyword And Ignore Error Get From Dictionary ${response.json()} data
${getlogintoken_supplier} Set Variable If "${get_status}"=="FAIL" ${gettoken_supplier}
... "${token}"=="None" ${gettoken_supplier} ${token}
#全局token
Set Global Variable ${getlogintoken_supplier}
#&{cloudfactory_supplierheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666 Authorization=${getlogintoken_supplier}

58
003_enterprise_open_account_customer/printing_packaging_factory_open_account.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library DatabaseLibrary
Library RequestsLibrary
Library Collections
@ -7,6 +6,9 @@ Library urllib3
*** Variables ***
&{operation_backend_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847952999 Authorization=${gettoken_operate}
&{cloud_factory_customer_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388
${uecclient} https://api-client-uec-test.qniao.cn
${yytclient} https://api-client-yyt-test.qniao.cn
${yytops} https://api-ops-yyt-test.qniao.cn
${uecops} https://api-ops-uec-test.qniao.cn
@ -276,3 +278,57 @@ operate_get_printing_packaging_factory_employee_list
Should Be Equal As Strings successful ${response.json()["message"]}
Should Be Equal As Strings ${printing_packaging_factory_administrator_mobile} ${response.json()["data"]["records"][0]["mobile"]}
Should Be Equal As Strings ${printing_packaging_factory_administrator_realname} ${response.json()["data"]["records"][0]["realName"]}
customer_phone
#去除警告
Disable Warnings
#创建会话 会话别名 baseurl headers
Create Session uecclient ${uecclient} headers=${cloud_factory_customer_header}
#变量名称 设置用例变量 变量值
${accounttype} Set Variable 2 #账号类型 1微信 2手机号 3邮箱 4苹果 5自定义账号
${account} Set Variable 13012345678
${body} Set Variable {"accountType":${accounttype},"account":"${account}","captcha":"888888"}
#变量接收响应结果 post请求 会话别名 uri 传参
${response} POST On Session uecclient /uec/authorize/by-captcha ${body}
#日志
Log ${response.status_code}
#日志
Log ${response.text}
#日志
Log ${response.json()}
#断言数字 预期结果 实际结果
Should Be Equal As Numbers 200 ${response.status_code}
#断言字符串 预期结果 实际结果
Should Be Equal As Strings successful ${response.json()["message"]}
#变量接收token 获取字典内容 响应结果 token-key
${gettoken_customer} Get From Dictionary ${response.json()["data"]} token
#日志
log ${gettoken_customer}
#设置token变量 未转业务线
Set Suite Variable ${gettoken_customer}
#变量接收客户userid 获取字典内容 响应结果 userid-key
${userid_customer} Get From Dictionary ${response.json()["data"]} userId
#日志
log ${userid_customer}
#设置token变量
Set Suite Variable ${userid_customer}
#设置带token的请求头
&{cloudfactorycustomerheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${gettoken_customer}
#设置token变量
Set Suite Variable ${cloudfactorycustomerheader}
customer_login_token
Disable Warnings
Create Session yytclient ${yytclient} headers=${cloudfactorycustomerheader}
${body} Set Variable {"loginToken":"${gettoken_customer}"}
${response} POST On Session yytclient /cloud-print-user-center/authorize/get/product-line-token/by/login-token ${body.encode("utf8")}
Log ${response.status_code}
Log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
${getlogintoken_customer} Get From Dictionary ${response.json()} data
log ${getlogintoken_customer}
#全局token
Set Global Variable ${getlogintoken_customer}
&{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer}
Set Global Variable ${cloudfactory_customer_header}

56
004_enterprise_open_account_supplier/supplier_paper_open_account.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library DatabaseLibrary
Library RequestsLibrary
Library Collections
@ -8,6 +7,7 @@ Library urllib3
*** Variables ***
&{cloudfactory_supplierfocus_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666 Authorization=${getlogintoken_supplier_focus}
&{operation_backend_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847952999 Authorization=${gettoken_operate}
&{cloud_factory_supplier_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666
${uecclient} https://api-client-uec-test.qniao.cn
${yytclient} https://api-client-yyt-test.qniao.cn
${uecops} https://api-ops-uec-test.qniao.cn
@ -250,3 +250,57 @@ operate_get_supplier_paper_purchase_order_list
log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
supplier_phone
#去除警告
Disable Warnings
#创建会话 会话别名 baseurl headers
Create Session uecclient ${uecclient} headers=${cloud_factory_supplier_header}
#变量名称 设置用例变量 变量值
${accounttype} Set Variable 2 #账号类型 1微信 2手机号 3邮箱 4苹果 5自定义账号
${account} Set Variable 13123456789
${body} Set Variable {"accountType":${accounttype},"account":"${account}","captcha":"888888"}
#变量接收响应结果 post请求 会话别名 uri 传参
${response} POST On Session uecclient /uec/authorize/by-captcha ${body}
#日志
Log ${response.status_code}
#日志
Log ${response.text}
#日志
Log ${response.json()}
#断言数字 预期结果 实际结果
Should Be Equal As Numbers 200 ${response.status_code}
#断言字符串 预期结果 实际结果
Should Be Equal As Strings successful ${response.json()["message"]}
#变量接收token 获取字典内容 响应结果 token-key
${gettoken_supplier} Get From Dictionary ${response.json()["data"]} token
#日志
log ${gettoken_supplier}
#设置token变量 未转业务线
Set Suite Variable ${gettoken_supplier}
#变量接收供应商userid 获取字典内容 响应结果 userid-key
${userid_supplier} Get From Dictionary ${response.json()["data"]} userId
#日志
log ${userid_supplier}
#设置token变量
Set Suite Variable ${userid_supplier}
#设置带token的请求头
&{cloudfactorysupplierheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666 Authorization=${gettoken_supplier}
#设置token变量
Set Suite Variable ${cloudfactorysupplierheader}
supplier_login_token
Disable Warnings
Create Session yytclient ${yytclient} headers=${cloudfactorysupplierheader}
${body} Set Variable {"loginToken":"${gettoken_supplier}"}
${response} POST On Session yytclient /cloud-print-user-center/authorize/get/product-line-token/by/login-token ${body.encode("utf8")}
Log ${response.status_code}
Log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
${getlogintoken_supplier} Get From Dictionary ${response.json()} data
log ${getlogintoken_supplier}
#全局token
Set Global Variable ${getlogintoken_supplier}
&{cloudfactory_supplierheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666 Authorization=${getlogintoken_supplier}
Set Global Variable ${cloudfactory_supplierheader}

1
005_enterprise_apply_credit/apply_credit_qniao_customer.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

58
006_get_credit/customer_credit_password.robot

@ -1,69 +1,13 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3
*** Variables ***
&{cloud_factory_customer_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388
${uecclient} https://api-client-uec-test.qniao.cn
&{cloudfactory_customer_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer}
${yytclient} https://api-client-yyt-test.qniao.cn
*** Test Cases ***
customer_phone
#去除警告
Disable Warnings
#创建会话 会话别名 baseurl headers
Create Session uecclient ${uecclient} headers=${cloud_factory_customer_header}
#变量名称 设置用例变量 变量值
${accounttype} Set Variable 2 #账号类型 1微信 2手机号 3邮箱 4苹果 5自定义账号
${account} Set Variable 13012345678
${body} Set Variable {"accountType":${accounttype},"account":"${account}","captcha":"888888"}
#变量接收响应结果 post请求 会话别名 uri 传参
${response} POST On Session uecclient /uec/authorize/by-captcha ${body}
#日志
Log ${response.status_code}
#日志
Log ${response.text}
#日志
Log ${response.json()}
#断言数字 预期结果 实际结果
Should Be Equal As Numbers 200 ${response.status_code}
#断言字符串 预期结果 实际结果
Should Be Equal As Strings successful ${response.json()["message"]}
#变量接收token 获取字典内容 响应结果 token-key
${gettoken_customer} Get From Dictionary ${response.json()["data"]} token
#日志
log ${gettoken_customer}
#设置token变量 未转业务线
Set Suite Variable ${gettoken_customer}
#变量接收客户userid 获取字典内容 响应结果 userid-key
${userid_customer} Get From Dictionary ${response.json()["data"]} userId
#日志
log ${userid_customer}
#设置token变量
Set Suite Variable ${userid_customer}
#设置带token的请求头
&{cloudfactorycustomerheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${gettoken_customer}
#设置token变量
Set Suite Variable ${cloudfactorycustomerheader}
customer_login_token
Disable Warnings
Create Session yytclient ${yytclient} headers=${cloudfactorycustomerheader}
${body} Set Variable {"loginToken":"${gettoken_customer}"}
${response} POST On Session yytclient /cloud-print-user-center/authorize/get/product-line-token/by/login-token ${body.encode("utf8")}
Log ${response.status_code}
Log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
${getlogintoken_customer} Get From Dictionary ${response.json()} data
log ${getlogintoken_customer}
#全局token
Set Global Variable ${getlogintoken_customer}
&{cloudfactory_customer_header} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer}
Set Suite Variable ${cloudfactory_customer_header}
customer_get_credit_password_status
Create Session yytclient ${yytclient} headers=${cloudfactory_customer_header}
${response} Get On Session yytclient /cloud-print-user-center/credit/payment-password/getstatus

1
006_get_credit/customer_get_credit.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
007_paper_variety_management/paper_brand.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
007_paper_variety_management/paper_category.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library DatabaseLibrary
Library RequestsLibrary
Library Collections

1
007_paper_variety_management/paper_manufacturer.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
008_market_information/market_information_link.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
009_product_manage/product_add_and_list.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
010_limited_specialoffer/limited_specialoffer_product.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library DatabaseLibrary
Library RequestsLibrary
Library Collections

1
011_product_price_config/product_price_config_qniao_and_feisuan.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
012_product_price_update/product_price_batch_update_purchaseprice.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
013_paper_list_and_details/customer_get_paper_list_and_detail.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
014_shinpping_address/customer_enterprise_shipping_address.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
015_customer_create_order/customer_create_order_credit_payment.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
016_enquiry_create_order/customer_enquiry_operate_and_supplier_quoted_price_create_order.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

65
017_order_and_receipt_and_delivery/get_oeder_and_receipt_and_delivery.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3
@ -7,8 +6,6 @@ Library urllib3
*** Variables ***
&{cloudfactory_customer_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847965388 Authorization=${getlogintoken_customer}
&{cloudfactory_supplierfocus_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666 Authorization=${getlogintoken_supplier_focus}
&{cloud_factory_supplier_header} Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666
${uecclient} https://api-client-uec-test.qniao.cn
${yytclient} https://api-client-yyt-test.qniao.cn
*** Test Cases ***
@ -86,69 +83,15 @@ supplierfocus_create_supplier_order_batch
Should Be Equal As Strings successful ${response.json()["message"]}
sleep 1
supplier_phone
#去除警告
Disable Warnings
#创建会话 会话别名 baseurl headers
Create Session uecclient ${uecclient} headers=${cloud_factory_supplier_header}
#变量名称 设置用例变量 变量值
${accounttype} Set Variable 2 #账号类型 1微信 2手机号 3邮箱 4苹果 5自定义账号
${account} Set Variable 13123456789
${body} Set Variable {"accountType":${accounttype},"account":"${account}","captcha":"888888"}
#变量接收响应结果 post请求 会话别名 uri 传参
${response} POST On Session uecclient /uec/authorize/by-captcha ${body}
#日志
Log ${response.status_code}
#日志
Log ${response.text}
#日志
Log ${response.json()}
#断言数字 预期结果 实际结果
Should Be Equal As Numbers 200 ${response.status_code}
#断言字符串 预期结果 实际结果
Should Be Equal As Strings successful ${response.json()["message"]}
#变量接收token 获取字典内容 响应结果 token-key
${gettoken_supplier} Get From Dictionary ${response.json()["data"]} token
#日志
log ${gettoken_supplier}
#设置token变量 未转业务线
Set Suite Variable ${gettoken_supplier}
#变量接收供应商userid 获取字典内容 响应结果 userid-key
${userid_supplier} Get From Dictionary ${response.json()["data"]} userId
#日志
log ${userid_supplier}
#设置token变量
Set Suite Variable ${userid_supplier}
#设置带token的请求头
&{cloudfactorysupplierheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666 Authorization=${gettoken_supplier}
#设置token变量
Set Suite Variable ${cloudfactorysupplierheader}
supplier_login_token
Disable Warnings
Create Session yytclient ${yytclient} headers=${cloudfactorysupplierheader}
${body} Set Variable {"loginToken":"${gettoken_supplier}"}
${response} POST On Session yytclient /cloud-print-user-center/authorize/get/product-line-token/by/login-token ${body.encode("utf8")}
Log ${response.status_code}
Log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
${getlogintoken_supplier} Get From Dictionary ${response.json()} data
log ${getlogintoken_supplier}
#全局token
Set Global Variable ${getlogintoken_supplier}
&{cloudfactory_supplierheader} Create Dictionary Content-Type=application/json;charset=UTF-8 X-APP-ID=503258978847956666 Authorization=${getlogintoken_supplier}
Set Suite Variable ${cloudfactory_supplierheader}
supplier_get_order_list
Create Session yytclient ${yytclient} headers=${cloud_factory_supplier_header}
Create Session yytclient ${yytclient} headers=${cloudfactory_supplierheader}
${response} Get On Session yytclient /trading-center/wechatapplet/get/supplier-order-page
log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
Should Be Equal As Strings successful ${response.json()["message"]}
supplier_get_order_list_search
Create Session yytclient ${yytclient} headers=${cloud_factory_supplier_header}
Create Session yytclient ${yytclient} headers=${cloudfactory_supplierheader}
${param} Set Variable status=2 #供应商获取订单状态 2待送货
${response} Get On Session yytclient /trading-center/wechatapplet/get/supplier-order-page params=${param}
log ${response.json()}
@ -158,7 +101,7 @@ supplier_get_order_list_search
Set Global Variable ${supplier_order_id}
supplier_get_order_detail2
Create Session yytclient ${yytclient} headers=${cloud_factory_supplier_header}
Create Session yytclient ${yytclient} headers=${cloudfactory_supplierheader}
${response} Get On Session yytclient /trading-center/wechatapplet/get/supplier-order-detail/${supplier_order_id}
log ${response.json()}
Should Be Equal As Numbers 200 ${response.status_code}
@ -168,7 +111,7 @@ supplier_get_order_detail2
Set Global Variable ${supplier_order_totalPrice}
supplier_confirm_order
Create Session yytclient ${yytclient} headers=${cloud_factory_supplier_header}
Create Session yytclient ${yytclient} headers=${cloudfactory_supplierheader}
${body} Set Variable {"orderId":"${supplier_order_id}"}
${response} POST On Session yytclient /trading-center/seller/confirm/supplier-order-and-sign ${body.encode("utf-8")}
log ${response.json()}

1
018_payable_and_receivable/customer_bill.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
018_payable_and_receivable/payable.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
018_payable_and_receivable/receivable.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
019_capacity_market/capacity_commodity.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
019_capacity_market/capacity_machines.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library RequestsLibrary
Library Collections
Library urllib3

1
100_test_data_clear.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown
Library DatabaseLibrary
Library RequestsLibrary
Library Collections

1
__init__.robot

@ -1,5 +1,4 @@
*** Settings ***
Test Teardown Run Keyword If Test Failed Fatal Error
Library DatabaseLibrary
Library RequestsLibrary
Library Collections

Loading…
Cancel
Save