aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-robot/robot/resources/misc.robot
blob: 0dd15e9ae703d9a105bc925274d076af1396683f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
*** Settings ***
Library     Collections
Library     String
Library     UUID
Library     Process
Documentation     Miscellaneous keywords

Resource    json_templater.robot
Resource    scheduler_requests/create_schedule.robot


*** Variables ***

*** Keywords ***

Validate Status
    [Documentation]    Fail unless the Request response is in the passed list of valid HTTP status codes.
    [Arguments]    ${resp}    ${valid_status_list}
    ${status_code}   Convert To String   ${resp.status_code}
    Return From Keyword If   '${resp.status_code}' in ${valid_status_list}
    Fail   ${resp.status_code}
    
Validate JSON Error
    [Documentation]     Fails if messageIds do not match. expected_errors should be a list but a string would likely work as well
    [Arguments]    ${resp_json}    ${expected_errors}    ${listVars}
    ${result}=   Get From Dictionary   ${resp_json['requestError']}   messageId   
    ${variables}=   Get From Dictionary   ${resp_json['requestError']}   variables   
    Should Contain    ${expected_errors}    ${result}    #checks expected_errors list for the actual error received from schedule
    :for    ${var}   IN   @{listVars}
    \    Should Contain   ${variables}   ${var}
    
Check ATTIDs Template
   [Documentation]    This just checks a list of uuids 
   [Arguments]    ${expected_status_code}    ${template_folder}
   ${request_file}=    Convert to String    OneVnfImmediateATTID.json.template
   ${attid_file}=    OperatingSystem.Get File    robot/assets/AOTS_CM_IDs.txt
   @{attids}=    Split to lines    ${attid_file}
   :for    ${attid}    IN    @{attids}
   \   ${uuid}=    Generate UUID
   \   ${resp}=   Run Keyword and Continue on Failure    Create Schedule   ${uuid}   ${request_file}   ${template_folder}    attid=${attid}
   \   Run Keyword and Continue on Failure   Should Be Equal as Strings    ${resp.status_code}    ${expected_status_code}
   \   ${reps}=   Delete Change Management   auth   schedules/${uuid}