Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #23: DELETE body request warning #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion src/HttpLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from base64 import b64encode
from functools import wraps
from urlparse import urlparse
from webtest import utils

import livetest
import json
Expand Down Expand Up @@ -278,7 +279,7 @@ def DELETE(self, url):
logger.debug("Performing DELETE request on %s://%s%s" % (
self.context._scheme, self.app.host, url))
self.context.post_process_request(
self.app.delete(path, {}, self.context.request_headers)
self.app.delete(path, utils.NoDefault, self.context.request_headers)
)

def follow_response(self):
Expand Down Expand Up @@ -489,6 +490,22 @@ def response_body_should_contain(self, should_contain):
'"%s" should have contained "%s", but did not.' % (
self.response.body, should_contain)

def response_body_should_not_contain(self, should_not_contain):
"""
Fails if the response body does contain `should_not_contain`

Example:
| GET | /foo.xml |
| Response Body Should Not Contain | 404 |
| Response Body Should Not Contain | ERROR |
"""
logger.debug('Testing whether "%s" does not contain "%s".' % (
self.response.body, should_not_contain))

assert should_not_contain not in self.response.body, \
'"%s" should not have contained "%s", but it did.' % (
self.response.body, should_not_contain)

def log_response_body(self, log_level='INFO'):
"""
Logs the response body.
Expand Down