blob: b5092f86ab3ac4f998b038f30cff671a7d9aab4c [file] [log] [blame]
econwar92924972018-07-31 13:46:27 +00001*** Settings ***
2Library OperatingSystem
3Library RequestsLibrary
4Library requests
5Library Collections
6Library String
7
8*** Variables ***
econwar5dfc6282018-08-08 16:35:40 +00009${TARGET_URL} https://${DR_PROV_IP}:8443
10${TARGET_URL_FEED} https://${DR_PROV_IP}:8443/feed/1
econward5340482018-08-08 14:05:22 +000011${TARGET_URL_SUBSCRIBE} https://${DR_PROV_IP}:8443/subscribe/1
econware7fb2a22018-08-08 16:07:29 +000012${TARGET_URL_SUBSCRIPTION} https://${DR_PROV_IP}:8443/subs/1
econward5340482018-08-08 14:05:22 +000013${CREATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": ["${DR_PROV_IP}"], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
econwar5dfc6282018-08-08 16:35:40 +000014${UPDATE_FEED_DATA} {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": ["${DR_PROV_IP}"], "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
econward5340482018-08-08 14:05:22 +000015${SUBSCRIBE_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"}
econware7fb2a22018-08-08 16:07:29 +000016${UPDATE_SUBSCRIPTION_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"}
econward5340482018-08-08 14:05:22 +000017${FEED_CONTENT_TYPE} application/vnd.att-dr.feed
18${SUBSCRIBE_CONTENT_TYPE} application/vnd.att-dr.subscription
econwar92924972018-07-31 13:46:27 +000019
20*** Test Cases ***
21Run Feed Creation
22 [Documentation] Feed Creation
23 [Timeout] 1 minute
econwar5dfc6282018-08-08 16:35:40 +000024 ${resp}= PostCall ${TARGET_URL} ${CREATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m
25 log ${TARGET_URL}
econwar92924972018-07-31 13:46:27 +000026 log ${resp.text}
27 Should Be Equal As Strings ${resp.status_code} 201
28 log 'JSON Response Code:'${resp}
29
econward5340482018-08-08 14:05:22 +000030Run Subscribe to Feed
31 [Documentation] Subscribe to Feed
32 [Timeout] 1 minute
33 ${resp}= PostCall ${TARGET_URL_SUBSCRIBE} ${SUBSCRIBE_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n
34 log ${TARGET_URL_SUBSCRIBE}
35 log ${resp.text}
36 Should Be Equal As Strings ${resp.status_code} 201
37 log 'JSON Response Code:'${resp}
econwar92924972018-07-31 13:46:27 +000038
econware7fb2a22018-08-08 16:07:29 +000039Run Update Subscription
40 [Documentation] Update Subscription to suspend and change delivery credentials
41 [Timeout] 1 minute
42 ${resp}= PutCall ${TARGET_URL_SUBSCRIPTION} ${UPDATE_SUBSCRIPTION_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n
43 log ${TARGET_URL_SUBSCRIPTION}
44 log ${resp.text}
45 Should Be Equal As Strings ${resp.status_code} 200
46 log 'JSON Response Code:'${resp}
47 ${resp}= GetCall ${TARGET_URL_SUBSCRIPTION} ${SUBSCRIBE_CONTENT_TYPE} sg481n
48 log ${resp.text}
49 Should Contain ${resp.text} "password":"sg481n","user":"sg481n"
50 log 'JSON Response Code:'${resp}
51
econwar5dfc6282018-08-08 16:35:40 +000052Run Update Feed
53 [Documentation] Update Feed description and suspend
54 [Timeout] 1 minute
55 ${resp}= PutCall ${TARGET_URL_FEED} ${UPDATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m
56 log ${TARGET_URL_FEED}
57 log ${resp.text}
58 Should Be Equal As Strings ${resp.status_code} 200
59 log 'JSON Response Code:'${resp}
60 ${resp}= GetCall ${TARGET_URL_FEED} ${FEED_CONTENT_TYPE} rs873m
61 log ${resp.text}
62 Should Contain ${resp.text} "UPDATED-CSIT_Test"
63 log 'JSON Response Code:'${resp}
64
econwar81708b82018-08-08 16:46:51 +000065Run Delete Subscription
66 [Documentation] Delete Subscription
67 [Timeout] 1 minute
68 ${resp}= DeleteCall ${TARGET_URL_SUBSCRIPTION} sg481n
69 log ${resp.text}
70 Should Be Equal As Strings ${resp.status_code} 204
71 log 'JSON Response Code:'${resp}
72
econwar6d5e8082018-08-08 17:17:18 +000073Run Delete Feed
74 [Documentation] Delete Feed
75 [Timeout] 1 minute
76 ${resp}= DeleteCall ${TARGET_URL_FEED} rs873m
77 log ${resp.text}
78 Should Be Equal As Strings ${resp.status_code} 204
79 log 'JSON Response Code:'${resp}
80
econwar92924972018-07-31 13:46:27 +000081*** Keywords ***
econward5340482018-08-08 14:05:22 +000082PostCall
83 [Arguments] ${url} ${data} ${content_type} ${user}
84 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
85 ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests
86 [Return] ${resp}
econware7fb2a22018-08-08 16:07:29 +000087
88PutCall
89 [Arguments] ${url} ${data} ${content_type} ${user}
90 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
91 ${resp}= Evaluate requests.put('${url}',data='${data}', headers=${headers},verify=False) requests
92 [Return] ${resp}
93
94GetCall
95 [Arguments] ${url} ${content_type} ${user}
96 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type}
97 ${resp}= Evaluate requests.get('${url}', headers=${headers},verify=False) requests
98 [Return] ${resp}
econwar81708b82018-08-08 16:46:51 +000099
100DeleteCall
101 [Arguments] ${url} ${user}
102 ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user}
103 ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests
104 [Return] ${resp}