Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation CPS Core - Data REST API |
| 3 | |
| 4 | Library Collections |
| 5 | Library OperatingSystem |
| 6 | Library RequestsLibrary |
| 7 | |
| 8 | Suite Setup Create Session CPS_HOST ${CPS_HOST} |
| 9 | |
| 10 | *** Variables *** |
| 11 | |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 12 | ${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE= |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 13 | ${basePath} /cps/api |
| 14 | ${dataspaceName} CSIT-Dataspace |
| 15 | ${anchorName} CSIT-Anchor |
| 16 | |
| 17 | *** Test Cases *** |
| 18 | Create Data Node |
| 19 | ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/nodes |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 20 | ${headers} Create Dictionary Content-Type=application/json Authorization=${auth} |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 21 | ${jsonData}= Get Binary File ${DATADIR}${/}test-tree.json |
| 22 | ${response}= POST On Session CPS_HOST ${uri} headers=${headers} data=${jsonData} |
| 23 | Should Be Equal As Strings ${response.status_code} 201 |
| 24 | |
| 25 | Get Data Node by XPath |
| 26 | ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/node |
| 27 | ${params}= Create Dictionary xpath=/test-tree/branch[@name='Left']/nest |
Bruno Sakoto | f05a503 | 2021-03-03 18:27:54 -0500 | [diff] [blame] | 28 | ${headers}= Create Dictionary Authorization=${auth} |
| 29 | ${response}= Get On Session CPS_HOST ${uri} params=${params} headers=${headers} expected_status=200 |
Ruslan Kashapov | d44fcee | 2021-02-26 11:42:29 +0200 | [diff] [blame] | 30 | ${responseJson}= Set Variable ${response.json()} |
| 31 | Should Be Equal As Strings ${responseJson['name']} Small |
| 32 | |
| 33 | |