Skip to content

Instantly share code, notes, and snippets.

@Noordsestern
Last active December 22, 2021 20:01
Show Gist options
  • Save Noordsestern/3156d8b2466f6b18d3159c87ceb190bd to your computer and use it in GitHub Desktop.
Save Noordsestern/3156d8b2466f6b18d3159c87ceb190bd to your computer and use it in GitHub Desktop.
Robot Test Case for WebhookMock.py
*** Settings ***
Library RequestsLibrary
Library Collections
Library json
Test Setup Prepare test case
*** Test Cases ***
Test webhook with Text
${payload_text} Set Variable Hello World
POST http://localhost:8000/foo/bar data=${payload_text}
Validate response contains '${payload_text}'
Test webhook with Json
${payload_json} Create Dictionary message=Hello World
POST http://localhost:8000/foo/bar json=${payload_json}
Validate response contains '${payload_json}'
*** Keywords ***
Prepare test case
Remove old test data
Validate no test data is left
Remove old test data
DELETE http://localhost:8000/foo/bar
Validate no test data is left
GET http://localhost:8000/foo/bar expected_status=404
Validate response contains '${payload}'
${response} GET http://localhost:8000/foo/bar
${list_of_recorded_requests} loads ${response.text}
List Should Contain Value ${list_of_recorded_requests} ${payload}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment