vrvarma | 3fe70c7 | 2018-09-28 10:30:00 -0400 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library json |
| 3 | Library OperatingSystem |
| 4 | Resource ./resources/common-keywords.robot |
| 5 | |
| 6 | Suite Teardown Delete All Sessions |
| 7 | |
| 8 | *** Variables *** |
| 9 | ${osdf_host} ${OSDF_HOSTNAME}:${OSDF_PORT} |
| 10 | &{placement_auth} = username=test password=testpwd |
| 11 | &{wrong_authorization} = username=test password=test |
| 12 | &{pci_auth}= username=pci_test password=pci_testpwd |
| 13 | |
| 14 | *** Test Cases *** |
| 15 | Healthcheck |
| 16 | [Documentation] It sends a REST GET request to healthcheck url |
| 17 | ${resp}= Http Get ${osdf_host} /api/oof/v1/healthcheck |
| 18 | Should Be Equal As Integers ${resp.status_code} 200 |
| 19 | |
| 20 | SendPlacementWithInvalidAuth |
| 21 | [Documentation] It sends a POST request to osdf fail authentication |
| 22 | ${data}= Get Binary File ${CURDIR}${/}data${/}placement_request.json |
| 23 | ${resp}= Http Post host=${osdf_host} restUrl=/api/oof/v1/placement data=${data} auth=${wrong_authorization} |
| 24 | ${response_json} json.loads ${resp.content} |
| 25 | Should Be Equal Unauthorized, check username and password ${response_json['serviceException']['text']} |
| 26 | Should Be Equal As Integers ${resp.status_code} 401 |
| 27 | |
| 28 | SendPlacementWithValidAuth |
| 29 | [Documentation] It sends a POST request to osdf with correct authentication |
| 30 | ${data}= Get Binary File ${CURDIR}${/}data${/}placement_request.json |
| 31 | ${resp}= Http Post host=${osdf_host} restUrl=/api/oof/v1/placement data=${data} auth=${placement_auth} |
| 32 | ${response_json} json.loads ${resp.content} |
| 33 | Should Be Equal As Integers ${resp.status_code} 202 |
| 34 | Should Be Equal accepted ${response_json['requestStatus']} |
| 35 | |
vrvarma | c59a09a | 2020-03-18 15:59:21 -0400 | [diff] [blame] | 36 | SendPCIOptimizationWithAuth |
| 37 | [Documentation] It sends a POST request PCI Optimization service |
| 38 | |
| 39 | ${data}= Get Binary File ${CURDIR}${/}data${/}pci-opt-request.json |
| 40 | ${resp}= Http Post host=${osdf_host} restUrl=/api/oof/v1/pci data=${data} auth=${pci_auth} |
| 41 | ${response_json} json.loads ${resp.content} |
| 42 | Should Be Equal As Integers ${resp.status_code} 202 |
| 43 | Should Be Equal accepted ${response_json['requestStatus']} |
vrvarma | 3fe70c7 | 2018-09-28 10:30:00 -0400 | [diff] [blame] | 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |