econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Library OperatingSystem |
| 3 | Library RequestsLibrary |
| 4 | Library requests |
| 5 | Library Collections |
| 6 | Library String |
| 7 | |
| 8 | *** Variables *** |
econwar | 5dfc628 | 2018-08-08 16:35:40 +0000 | [diff] [blame] | 9 | ${TARGET_URL} https://${DR_PROV_IP}:8443 |
| 10 | ${TARGET_URL_FEED} https://${DR_PROV_IP}:8443/feed/1 |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 11 | ${TARGET_URL_SUBSCRIBE} https://${DR_PROV_IP}:8443/subscribe/1 |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame] | 12 | ${TARGET_URL_SUBSCRIPTION} https://${DR_PROV_IP}:8443/subs/1 |
econwar | 18088d8 | 2018-08-09 14:21:29 +0000 | [diff] [blame] | 13 | ${TARGET_URL_PUBLISH} https://${DR_NODE_IP}:8443/publish/1/csit_test |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 14 | ${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"}]}} |
econwar | 5dfc628 | 2018-08-08 16:35:40 +0000 | [diff] [blame] | 15 | ${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"}]}} |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 16 | ${SUBSCRIBE_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"} |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame] | 17 | ${UPDATE_SUBSCRIPTION_DATA} {"delivery":{ "url":"https://${DR_PROV_IP}:8080/", "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"} |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 18 | ${FEED_CONTENT_TYPE} application/vnd.att-dr.feed |
| 19 | ${SUBSCRIBE_CONTENT_TYPE} application/vnd.att-dr.subscription |
econwar | 18088d8 | 2018-08-09 14:21:29 +0000 | [diff] [blame] | 20 | ${PUBLISH_FEED_CONTENT_TYPE} application/octet-stream |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 21 | |
| 22 | *** Test Cases *** |
| 23 | Run Feed Creation |
| 24 | [Documentation] Feed Creation |
| 25 | [Timeout] 1 minute |
econwar | 5dfc628 | 2018-08-08 16:35:40 +0000 | [diff] [blame] | 26 | ${resp}= PostCall ${TARGET_URL} ${CREATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m |
| 27 | log ${TARGET_URL} |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 28 | log ${resp.text} |
| 29 | Should Be Equal As Strings ${resp.status_code} 201 |
| 30 | log 'JSON Response Code:'${resp} |
| 31 | |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 32 | Run Subscribe to Feed |
| 33 | [Documentation] Subscribe to Feed |
| 34 | [Timeout] 1 minute |
| 35 | ${resp}= PostCall ${TARGET_URL_SUBSCRIBE} ${SUBSCRIBE_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n |
| 36 | log ${TARGET_URL_SUBSCRIBE} |
| 37 | log ${resp.text} |
| 38 | Should Be Equal As Strings ${resp.status_code} 201 |
| 39 | log 'JSON Response Code:'${resp} |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 40 | |
econwar | 18088d8 | 2018-08-09 14:21:29 +0000 | [diff] [blame] | 41 | Run Publish Feed |
| 42 | [Documentation] Publish to Feed |
| 43 | [Timeout] 1 minute |
| 44 | Sleep 10s Behaviour was noticed where feed was not created in time for publish to be sent |
| 45 | ${resp}= PutCall ${TARGET_URL_PUBLISH} ${CREATE_FEED_DATA} ${PUBLISH_FEED_CONTENT_TYPE} rs873m |
| 46 | log ${TARGET_URL_PUBLISH} |
| 47 | log ${resp.text} |
| 48 | Should Be Equal As Strings ${resp.status_code} 204 |
| 49 | log 'JSON Response Code:'${resp} |
| 50 | |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame] | 51 | Run Update Subscription |
| 52 | [Documentation] Update Subscription to suspend and change delivery credentials |
| 53 | [Timeout] 1 minute |
| 54 | ${resp}= PutCall ${TARGET_URL_SUBSCRIPTION} ${UPDATE_SUBSCRIPTION_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n |
| 55 | log ${TARGET_URL_SUBSCRIPTION} |
| 56 | log ${resp.text} |
| 57 | Should Be Equal As Strings ${resp.status_code} 200 |
| 58 | log 'JSON Response Code:'${resp} |
| 59 | ${resp}= GetCall ${TARGET_URL_SUBSCRIPTION} ${SUBSCRIBE_CONTENT_TYPE} sg481n |
| 60 | log ${resp.text} |
| 61 | Should Contain ${resp.text} "password":"sg481n","user":"sg481n" |
| 62 | log 'JSON Response Code:'${resp} |
| 63 | |
econwar | 5dfc628 | 2018-08-08 16:35:40 +0000 | [diff] [blame] | 64 | Run Update Feed |
| 65 | [Documentation] Update Feed description and suspend |
| 66 | [Timeout] 1 minute |
| 67 | ${resp}= PutCall ${TARGET_URL_FEED} ${UPDATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m |
| 68 | log ${TARGET_URL_FEED} |
| 69 | log ${resp.text} |
| 70 | Should Be Equal As Strings ${resp.status_code} 200 |
| 71 | log 'JSON Response Code:'${resp} |
| 72 | ${resp}= GetCall ${TARGET_URL_FEED} ${FEED_CONTENT_TYPE} rs873m |
| 73 | log ${resp.text} |
| 74 | Should Contain ${resp.text} "UPDATED-CSIT_Test" |
| 75 | log 'JSON Response Code:'${resp} |
| 76 | |
econwar | 81708b8 | 2018-08-08 16:46:51 +0000 | [diff] [blame] | 77 | Run Delete Subscription |
| 78 | [Documentation] Delete Subscription |
| 79 | [Timeout] 1 minute |
| 80 | ${resp}= DeleteCall ${TARGET_URL_SUBSCRIPTION} sg481n |
| 81 | log ${resp.text} |
| 82 | Should Be Equal As Strings ${resp.status_code} 204 |
| 83 | log 'JSON Response Code:'${resp} |
| 84 | |
econwar | 6d5e808 | 2018-08-08 17:17:18 +0000 | [diff] [blame] | 85 | Run Delete Feed |
| 86 | [Documentation] Delete Feed |
| 87 | [Timeout] 1 minute |
| 88 | ${resp}= DeleteCall ${TARGET_URL_FEED} rs873m |
| 89 | log ${resp.text} |
| 90 | Should Be Equal As Strings ${resp.status_code} 204 |
| 91 | log 'JSON Response Code:'${resp} |
| 92 | |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 93 | *** Keywords *** |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 94 | PostCall |
| 95 | [Arguments] ${url} ${data} ${content_type} ${user} |
| 96 | ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} |
| 97 | ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests |
| 98 | [Return] ${resp} |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame] | 99 | |
| 100 | PutCall |
| 101 | [Arguments] ${url} ${data} ${content_type} ${user} |
econwar | 18088d8 | 2018-08-09 14:21:29 +0000 | [diff] [blame] | 102 | ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} Authorization=Basic cnM4NzNtOnJzODczbQ== |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame] | 103 | ${resp}= Evaluate requests.put('${url}',data='${data}', headers=${headers},verify=False) requests |
| 104 | [Return] ${resp} |
| 105 | |
| 106 | GetCall |
| 107 | [Arguments] ${url} ${content_type} ${user} |
| 108 | ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} |
| 109 | ${resp}= Evaluate requests.get('${url}', headers=${headers},verify=False) requests |
| 110 | [Return] ${resp} |
econwar | 81708b8 | 2018-08-08 16:46:51 +0000 | [diff] [blame] | 111 | |
| 112 | DeleteCall |
| 113 | [Arguments] ${url} ${user} |
| 114 | ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} |
| 115 | ${resp}= Evaluate requests.delete('${url}', headers=${headers},verify=False) requests |
| 116 | [Return] ${resp} |