SetValidPatient.robot 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. *** Settings ***
  2. Documentation 设置成有效已登记病人接口
  3. Library Collections
  4. Library HttpLibrary.HTTP
  5. Library RequestsLibrary
  6. *** Variables ***
  7. ${uri} /IPatientService
  8. ${method} SetValidPatient
  9. *** Test Cases ***
  10. *** Keywords ***
  11. setValidPatient_Post
  12. [Arguments] ${token} ${newPatientCode} ${oldPatientCode}
  13. ${params} Create List
  14. ${param} Create Dictionary
  15. Set To Dictionary ${param} Token ${token}
  16. Set To Dictionary ${param} NewPatientCode ${newPatientCode}
  17. Set To Dictionary ${param} OldPatientCode ${oldPatientCode}
  18. Append To List ${params} ${param}
  19. ${data} common_data ${method} ${params}
  20. Log ${data}
  21. Log ---开始断言验证---
  22. ${response} request_post ${URL} ${uri} ${data}
  23. Log ${response}
  24. log ${response.content}
  25. ${content} Set Variable ${response.content}
  26. Log ---输出返回内容---:
  27. Log Json ${content} INFO
  28. Log ---开始断言验证---
  29. Should Be True ${response.status_code}==200
  30. [Return] ${response}
  31. setValidPatient_assertClassTrue
  32. [Arguments] ${token} ${newPatientCode} ${oldPatientCode}
  33. ${content} setValidPatient_Post ${token} ${newPatientCode} ${oldPatientCode}
  34. ${result} Get From Dictionary ${content.json()} result
  35. Log ${result}
  36. Should Be True ${result}
  37. [Return] ${content}
  38. setValidPatient_assertException
  39. [Arguments] ${token} ${newPatientCode} ${oldPatientCode} ${error_code} ${error_msg}
  40. ${content} setValidPatient_Post ${token} ${newPatientCode} ${oldPatientCode}
  41. ${error} Get From Dictionary ${content.json()} error
  42. ${code} Get From Dictionary ${error} code
  43. ${message} Get From Dictionary ${error} message
  44. Should Be Equal As Numbers ${code} ${error_code}
  45. Should Be String ${message} ${error_msg}
  46. [Return] ${content}