CreatePatient.robot 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. *** Settings ***
  2. Documentation 创建病人
  3. Library Collections
  4. Library HttpLibrary.HTTP
  5. Library RequestsLibrary
  6. *** Variables ***
  7. ${uri} /IPatientService
  8. ${method} CreatePatient
  9. *** Test Cases ***
  10. test
  11. [Tags] inexecution
  12. ${body} Create Dictionary
  13. Set To Dictionary ${body} jsonrpc 2.0
  14. Set To Dictionary ${body} method CreatePatient
  15. ${params} Create List
  16. ${param} Create Dictionary
  17. Set To Dictionary ${param} Token 0126f5d7ef044088b075246c65a410ba
  18. ${PatientData} Create List
  19. ${animal} Random Animal
  20. Append To List ${PatientData} ${animal}
  21. Set To Dictionary ${param} PatientData ${PatientData}
  22. ${AssignmentUserCodes} Create List
  23. Append To List ${AssignmentUserCodes} uc_code01
  24. Append To List ${AssignmentUserCodes} uc_code02
  25. Set To Dictionary ${param} AssignmentUserCodes ${AssignmentUserCodes}
  26. Append To List ${params} ${param}
  27. Set To Dictionary ${body} params ${params}
  28. Set To Dictionary ${body} id 1
  29. Log ${body}
  30. test2
  31. [Tags] inexecution
  32. ${body} Create Dictionary
  33. Set To Dictionary ${body} jsonrpc 2.0
  34. Set To Dictionary ${body} method CreatePatient
  35. ${params} Create List
  36. ${param} Create Dictionary
  37. Set To Dictionary ${param} Token 0126f5d7ef044088b075246c65a410ba
  38. ${PatientData} Create List
  39. ${animal} Random Patient
  40. Append To List ${PatientData} ${animal}
  41. Set To Dictionary ${param} PatientData ${PatientData}
  42. ${AssignmentUserCodes} Create List
  43. Append To List ${AssignmentUserCodes} uc_code01
  44. Append To List ${AssignmentUserCodes} uc_code02
  45. Set To Dictionary ${param} AssignmentUserCodes ${AssignmentUserCodes}
  46. Append To List ${params} ${param}
  47. Set To Dictionary ${body} params ${params}
  48. Set To Dictionary ${body} id 1
  49. Log ${body}
  50. *** Keywords ***
  51. createPatient_Post
  52. [Arguments] ${token} ${PatientData} ${assignmentUserCodes}
  53. ${params} Create List
  54. ${param} Create Dictionary
  55. Set To Dictionary ${param} Token ${token}
  56. ${organizationInfos} Create List
  57. ${organizationInfo} Create Dictionary
  58. Set To Dictionary ${organizationInfo} OrganizationName ${organizationName}
  59. Set To Dictionary ${organizationInfo} ParentCode ${parentCode}
  60. Set To Dictionary ${organizationInfo} ExtendsData ${extendsData}
  61. ${patientType11} Convert To Integer ${patientType}
  62. Set To Dictionary ${organizationInfo} PatientType ${patientType11}
  63. Append To List ${organizationInfos} ${organizationInfo}
  64. Set To Dictionary ${param} OrganizationInfos ${organizationInfos}
  65. Append To List ${params} ${param}
  66. ${data} common_data ${method} ${params}
  67. Log ${data}
  68. Log ---开始断言验证---
  69. ${response} request_post ${URL} ${uri} ${data}
  70. Log ${response}
  71. log ${response.content}
  72. ${content} Set Variable ${response.content}
  73. Log ---输出返回内容---:
  74. Log Json ${content} INFO
  75. Log ---开始断言验证---
  76. Should Be True ${response.status_code}==200
  77. [Return] ${response}
  78. createPatient_assertClassTrue
  79. [Arguments] ${token} ${organizationName} ${parentCode} ${extendsData} ${patientType}
  80. ${content} addOrganizations_Post ${token} ${organizationName} ${parentCode} ${extendsData} ${patientType}
  81. ${result} Get From Dictionary ${content.json()} result
  82. Log ${result}
  83. Should Be True ${result}
  84. [Return] ${content}
  85. createPatient_assertException
  86. [Arguments] ${token} ${organizationName} ${parentCode} ${extendsData} ${patientType} ${error_code} ${error_msg}
  87. ${content} addOrganizations_Post ${token} ${organizationName} ${parentCode} ${extendsData} ${patientType}
  88. ${error} Get From Dictionary ${content.json()} error
  89. ${code} Get From Dictionary ${error} code
  90. ${message} Get From Dictionary ${error} message
  91. Should Be Equal As Numbers ${code} ${error_code}
  92. Should Be String ${message} ${error_msg}
  93. [Return] ${content}