blob: ff1e8d0480b588118143a2bc35884921fc68d190 [file] [log] [blame]
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +02001*** Settings ***
2Documentation CPS Core - Data REST API
3
4Library Collections
5Library OperatingSystem
6Library RequestsLibrary
7
8Suite Setup Create Session CPS_HOST ${CPS_HOST}
9
10*** Variables ***
11
Bruno Sakotof05a5032021-03-03 18:27:54 -050012${auth} Basic Y3BzdXNlcjpjcHNyMGNrcyE=
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020013${basePath} /cps/api
14${dataspaceName} CSIT-Dataspace
15${anchorName} CSIT-Anchor
16
17*** Test Cases ***
18Create Data Node
19 ${uri}= Set Variable ${basePath}/v1/dataspaces/${dataspaceName}/anchors/${anchorName}/nodes
Bruno Sakotof05a5032021-03-03 18:27:54 -050020 ${headers} Create Dictionary Content-Type=application/json Authorization=${auth}
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020021 ${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
25Get 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 Sakotof05a5032021-03-03 18:27:54 -050028 ${headers}= Create Dictionary Authorization=${auth}
29 ${response}= Get On Session CPS_HOST ${uri} params=${params} headers=${headers} expected_status=200
Ruslan Kashapovd44fcee2021-02-26 11:42:29 +020030 ${responseJson}= Set Variable ${response.json()}
31 Should Be Equal As Strings ${responseJson['name']} Small
32
33