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 | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 9 | ${TARGET_URL_FEED} https://${DR_PROV_IP}:8443 |
| 10 | ${TARGET_URL_SUBSCRIBE} https://${DR_PROV_IP}:8443/subscribe/1 |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame^] | 11 | ${TARGET_URL_SUBSCRIPTION} https://${DR_PROV_IP}:8443/subs/1 |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 12 | ${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"}]}} |
| 13 | ${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^] | 14 | ${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] | 15 | ${FEED_CONTENT_TYPE} application/vnd.att-dr.feed |
| 16 | ${SUBSCRIBE_CONTENT_TYPE} application/vnd.att-dr.subscription |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 17 | |
| 18 | *** Test Cases *** |
| 19 | Run Feed Creation |
| 20 | [Documentation] Feed Creation |
| 21 | [Timeout] 1 minute |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 22 | ${resp}= PostCall ${TARGET_URL_FEED} ${CREATE_FEED_DATA} ${FEED_CONTENT_TYPE} rs873m |
| 23 | log ${TARGET_URL_FEED} |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 24 | log ${resp.text} |
| 25 | Should Be Equal As Strings ${resp.status_code} 201 |
| 26 | log 'JSON Response Code:'${resp} |
| 27 | |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 28 | Run Subscribe to Feed |
| 29 | [Documentation] Subscribe to Feed |
| 30 | [Timeout] 1 minute |
| 31 | ${resp}= PostCall ${TARGET_URL_SUBSCRIBE} ${SUBSCRIBE_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n |
| 32 | log ${TARGET_URL_SUBSCRIBE} |
| 33 | log ${resp.text} |
| 34 | Should Be Equal As Strings ${resp.status_code} 201 |
| 35 | log 'JSON Response Code:'${resp} |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 36 | |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame^] | 37 | Run Update Subscription |
| 38 | [Documentation] Update Subscription to suspend and change delivery credentials |
| 39 | [Timeout] 1 minute |
| 40 | ${resp}= PutCall ${TARGET_URL_SUBSCRIPTION} ${UPDATE_SUBSCRIPTION_DATA} ${SUBSCRIBE_CONTENT_TYPE} sg481n |
| 41 | log ${TARGET_URL_SUBSCRIPTION} |
| 42 | log ${resp.text} |
| 43 | Should Be Equal As Strings ${resp.status_code} 200 |
| 44 | log 'JSON Response Code:'${resp} |
| 45 | ${resp}= GetCall ${TARGET_URL_SUBSCRIPTION} ${SUBSCRIBE_CONTENT_TYPE} sg481n |
| 46 | log ${resp.text} |
| 47 | Should Contain ${resp.text} "password":"sg481n","user":"sg481n" |
| 48 | log 'JSON Response Code:'${resp} |
| 49 | |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 50 | *** Keywords *** |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 51 | PostCall |
| 52 | [Arguments] ${url} ${data} ${content_type} ${user} |
| 53 | ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} |
| 54 | ${resp}= Evaluate requests.post('${url}',data='${data}', headers=${headers},verify=False) requests |
| 55 | [Return] ${resp} |
econwar | e7fb2a2 | 2018-08-08 16:07:29 +0000 | [diff] [blame^] | 56 | |
| 57 | PutCall |
| 58 | [Arguments] ${url} ${data} ${content_type} ${user} |
| 59 | ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} |
| 60 | ${resp}= Evaluate requests.put('${url}',data='${data}', headers=${headers},verify=False) requests |
| 61 | [Return] ${resp} |
| 62 | |
| 63 | GetCall |
| 64 | [Arguments] ${url} ${content_type} ${user} |
| 65 | ${headers}= Create Dictionary X-ATT-DR-ON-BEHALF-OF=${user} Content-Type=${content_type} |
| 66 | ${resp}= Evaluate requests.get('${url}', headers=${headers},verify=False) requests |
| 67 | [Return] ${resp} |