sv764t | 8bf4998 | 2018-10-25 01:42:52 -0400 | [diff] [blame^] | 1 | *** Settings *** |
| 2 | Library Collections |
| 3 | Library String |
| 4 | #Library UUID |
| 5 | Library ../attlibs/UID.py |
| 6 | Library Process |
| 7 | Library HttpLibrary.HTTP |
| 8 | Documentation Miscellaneous keywords |
| 9 | |
| 10 | Resource json_templater.robot |
| 11 | Resource create_schedule.robot |
| 12 | |
| 13 | |
| 14 | *** Variables *** |
| 15 | |
| 16 | *** Keywords *** |
| 17 | |
| 18 | Validate Status |
| 19 | [Documentation] Fail unless the Request response is in the passed list of valid HTTP status codes. |
| 20 | [Arguments] ${resp} ${valid_status_list} |
| 21 | ${status_code} Convert To String ${resp.status_code} |
| 22 | Return From Keyword If '${resp.status_code}' in ${valid_status_list} |
| 23 | Fail ${resp.status_code} |
| 24 | |
| 25 | Validate JSON Error |
| 26 | [Documentation] Fails if messageIds do not match. expected_errors should be a list but a string would likely work as well |
| 27 | [Arguments] ${resp_json} ${expected_errors} |
| 28 | ${result}= Get From Dictionary ${resp_json['requestError']} messageId |
| 29 | Should Contain ${expected_errors} ${result} #checks expected_errors list for the actual error received from schedule |
| 30 | |
| 31 | Check ATTIDs Template |
| 32 | [Documentation] This just checks a list of uuids |
| 33 | [Arguments] ${expected_status_code} ${template_folder} |
| 34 | ${request_file}= Convert to String OneVnfImmediateATTID.json.template |
| 35 | ${attid_file}= OperatingSystem.Get File robot/assets/AOTS_CM_IDs.txt |
| 36 | @{attids}= Split to lines ${attid_file} |
| 37 | :for ${attid} in @{attids} |
| 38 | \ ${uuid}= Generate UUID |
| 39 | \ ${resp}= Run Keyword and Continue on Failure Create Schedule ${uuid} ${request_file} ${template_folder} attid=${attid} |
| 40 | \ Run Keyword and Continue on Failure Should Be Equal as Strings ${resp.status_code} ${expected_status_code} |
| 41 | \ ${reps}= Delete Change Management auth schedules/${uuid} |
| 42 | |
| 43 | |