Skip to content

Instantly share code, notes, and snippets.

@TooTallNate
Created August 15, 2018 17:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TooTallNate/92ab3643057a4310e1185aa7bc8fbb06 to your computer and use it in GitHub Desktop.
Save TooTallNate/92ab3643057a4310e1185aa7bc8fbb06 to your computer and use it in GitHub Desktop.
Running `shakedown` HTTP unit tests through `import`
#!/usr/bin/env bash
eval "`curl -sfLS import.pw`"
import "import.pw/robwhitby/shakedown" # load the framework
shakedown GET /foo # make a GET request
status 404 # assert on http status code
content_type 'text/html' # assert Content-Type header contains string
contains 'Not found' # assert body contains string
matches 'No.*' # assert body matches regex
shakedown HEAD / # make a HEAD request
status 302
shakedown GET / -H 'Accept: application/json' # add curl options
print_headers # output response headers for debugging
print_body # output response body for debugging
status 200
header 'Expires'
shakedown PUT /user/1 -d name=Rob # make a PUT request
status 201
shakedown GET http://www.google.com -L # provide full url to override default base url.
status 200 # -L cURL option to follow redirects
shakedown GET http://www.google.com
header_contains 'Referrer-Policy' 'no-referrer' # assert header 'Referrer-Policy' contains value 'no-referrer'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment