blob: 671e89b7a765b1aa25cd2b805ff382ff4f29738c [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001*** Settings ***
2Resource ../../common.robot
3Library Collections
4Library json
5Library OperatingSystem
6Library RequestsLibrary
7Library HttpLibrary.HTTP
8Library String
9
10
11*** Variables ***
efiacor3d202b52021-03-29 09:25:03 +010012${DBC_URI} webapi
13${DBC_URL} http://${DMAAPBC_IP}:8080/${DBC_URI}
Gary Wu9abb61c2018-09-27 10:38:50 -070014${LOC} csit-sanfrancisco
Gary Wu9abb61c2018-09-27 10:38:50 -070015${FEED1_DATA} { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
16${FEED2_DATA} { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
17${PUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" }
18${SUB2_DATA} { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" }
Gary Wu9abb61c2018-09-27 10:38:50 -070019
20
21*** Test Cases ***
Gary Wu9abb61c2018-09-27 10:38:50 -070022(DMAAP-441c1)
23 [Documentation] Create Feed w no clients POST ${DBC_URI}/feeds endpoint
efiacor3d202b52021-03-29 09:25:03 +010024 ${resp}= PostCall ${DBC_URL}/feeds ${FEED1_DATA}
25 Should Be Equal As Integers ${resp.status_code} 200
Gary Wu9abb61c2018-09-27 10:38:50 -070026
27(DMAAP-441c2)
28 [Documentation] Create Feed w clients POST ${DBC_URI}/feeds endpoint
efiacor3d202b52021-03-29 09:25:03 +010029 ${resp}= PostCall ${DBC_URL}/feeds ${FEED2_DATA}
30 Should Be Equal As Integers ${resp.status_code} 200
Gary Wu9abb61c2018-09-27 10:38:50 -070031
32(DMAAP-441c3)
33 [Documentation] Add Publisher to existing feed
efiacor3d202b52021-03-29 09:25:03 +010034 ${resp}= PostCall ${DBC_URL}/dr_pubs ${PUB2_DATA}
35 Should Be Equal As Integers ${resp.status_code} 201
36 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
37 ${result}= Set Variable ${JSON['pubId']}
38 Set Suite Variable ${pubId} ${result}
Gary Wu9abb61c2018-09-27 10:38:50 -070039
40(DMAAP-441c4)
41 [Documentation] Add Subscriber to existing feed
efiacor3d202b52021-03-29 09:25:03 +010042 ${resp}= PostCall ${DBC_URL}/dr_subs ${SUB2_DATA}
43 Should Be Equal As Integers ${resp.status_code} 201
44 ${JSON}= Evaluate json.loads(r"""${resp.content}""", strict=False)
45 ${result}= Set Variable ${JSON['subId']}
46 Set Suite Variable ${subId} ${result}
Gary Wu9abb61c2018-09-27 10:38:50 -070047
48(DMAAP-443)
49 [Documentation] List existing feeds
50 Create Session get ${DBC_URL}
efiacor3d202b52021-03-29 09:25:03 +010051 ${resp}= GET On Session get /feeds
52 Should Be Equal As Integers ${resp.status_code} 200
Gary Wu9abb61c2018-09-27 10:38:50 -070053
54(DMAAP-444)
55 [Documentation] Delete existing subscriber
efiacor3d202b52021-03-29 09:25:03 +010056 ${resp}= DelCall ${DBC_URL}/dr_subs/${subId}
57 Should Be Equal As Integers ${resp.status_code} 204
Gary Wu9abb61c2018-09-27 10:38:50 -070058
59(DMAAP-445)
60 [Documentation] Delete existing publisher
efiacor3d202b52021-03-29 09:25:03 +010061 ${resp}= DelCall ${DBC_URL}/dr_pubs/${pubId}
62 Should Be Equal As Integers ${resp.status_code} 204
Gary Wu9abb61c2018-09-27 10:38:50 -070063
64
65*** Keywords ***
Gary Wu9abb61c2018-09-27 10:38:50 -070066PostCall
67 [Arguments] ${url} ${data}
68 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
69 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
70 [Return] ${resp}
71
72DelCall
73 [Arguments] ${url}
74 ${headers}= Create Dictionary Accept=application/json Content-Type=application/json
75 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests
76 [Return] ${resp}