[DMAAP-BC] Consolidate bus controller repos
[dmaap/buscontroller.git] / csit / tests / with_dr / test1.robot
1 *** Settings ***
2 Library           Collections
3 Library           OperatingSystem
4 Library           RequestsLibrary
5
6 *** Variables ***
7 ${DBC_URL}     http://${DMAAPBC_IP}:8080/webapi
8 ${LOC}          csit-sanfrancisco
9 ${FEED1_DATA}  { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
10 ${FEED2_DATA}  { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
11 ${PUB2_DATA}   { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" }
12 ${SUB2_DATA}   { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" }
13
14
15 *** Test Cases ***
16 (DMAAP-441c1)
17     [Documentation]        Create Feed w no clients POST webapi/feeds endpoint
18     ${resp}=         PostCall     ${DBC_URL}/feeds    ${FEED1_DATA}
19     Should Be Equal As Integers   ${resp.status_code}  200
20
21 (DMAAP-441c2)
22     [Documentation]        Create Feed w clients POST webapi/feeds endpoint
23     ${resp}=         PostCall     ${DBC_URL}/feeds    ${FEED2_DATA}
24     Should Be Equal As Integers   ${resp.status_code}  200
25
26 (DMAAP-441c3)
27     [Documentation]        Add Publisher to existing feed
28     ${resp}=         PostCall      ${DBC_URL}/dr_pubs    ${PUB2_DATA}
29     Should Be Equal As Integers    ${resp.status_code}  201
30     ${JSON}=         Evaluate      json.loads(r"""${resp.content}""", strict=False)
31     ${result}=       Set Variable  ${JSON['pubId']}
32     Set Suite Variable             ${pubId}    ${result}
33
34 (DMAAP-441c4)
35     [Documentation]        Add Subscriber to existing feed
36     ${resp}=         PostCall      ${DBC_URL}/dr_subs    ${SUB2_DATA}
37     Should Be Equal As Integers    ${resp.status_code}  201
38     ${JSON}=         Evaluate      json.loads(r"""${resp.content}""", strict=False)
39     ${result}=       Set Variable  ${JSON['subId']}
40     Set Suite Variable             ${subId}    ${result}
41
42 (DMAAP-443)
43     [Documentation]        List existing feeds
44     ${resp}=       Evaluate    requests.get('${DBC_URL}/feeds', verify=False)    requests
45     Should Be Equal As Integers     ${resp.status_code}  200
46
47 (DMAAP-444)
48     [Documentation]        Delete existing subscriber
49     ${resp}=         DelCall        ${DBC_URL}/dr_subs/${subId}
50     Should Be Equal As Integers     ${resp.status_code}  204
51
52 (DMAAP-445)
53     [Documentation]        Delete existing publisher
54     ${resp}=         DelCall        ${DBC_URL}/dr_pubs/${pubId}
55     Should Be Equal As Integers     ${resp.status_code}  204
56
57
58 *** Keywords ***
59 PostCall
60     [Arguments]    ${url}           ${data}
61     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
62     ${resp}=       Evaluate    requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
63     [Return]       ${resp}
64
65 DelCall
66     [Arguments]    ${url}           
67     ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
68     ${resp}=       Evaluate    requests.delete('${url}', headers=${headers},verify=False)    requests
69     [Return]       ${resp}