summaryrefslogtreecommitdiffstats
path: root/test/csit/tests/dmaap-buscontroller/single-mr-suite/test1.robot
blob: f69538dc6e89931dfeb1e48cd80c1e6dcb8a4cb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
*** Settings ***
Resource          ../../common.robot
Library           Collections
Library           json
Library           OperatingSystem
Library           RequestsLibrary



*** Variables ***
${MESSAGE}    Hello, world!
${DBC_URI}    webapi
${TOPIC1}     singleMRtopic1
${TOPIC1_DATA}  { "topicName":"singleMRtopic1", "topicDescription":"generated for CSIT", "owner":"dgl"}



*** Test Cases ***
Url Test
    [Documentation]    Check if www.onap.org can be reached
    Create Session     sanity          http://onap.readthedocs.io
    ${resp}=           Get Request   sanity    /  
    Should Be Equal As Integers  ${resp.status_code}  200

Create Topic Test
    [Documentation]        Check POST ${DBC_URI}/topics endpoint
    ${resp}=         PostCall    http://${DMAAPBC_IP}:8080/${DBC_URI}/topics    ${TOPIC1_DATA}
    Should Be Equal As Integers  ${resp.status_code}  201

*** Keywords ***
CheckDir
    [Arguments]                 ${path}
    Directory Should Exist      ${path}

CheckUrl
    [Arguments]                  ${session}   ${path}     ${expect}
    ${resp}=                     Get  Request          ${session} ${path} 
    Should Be Equal As Integers  ${resp.status_code}  ${expect}

PostCall
    [Arguments]    ${url}           ${data}
    ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
    ${resp}=       Evaluate    requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
    [Return]       ${resp}