From 70fe5505aafed8772a72fb30ee87e6ade921f7dc Mon Sep 17 00:00:00 2001 From: Viktoras Date: Fri, 2 Aug 2013 20:23:13 +0200 Subject: [PATCH 1/2] Fixed DELETE body request warning --- src/HttpLibrary/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/HttpLibrary/__init__.py b/src/HttpLibrary/__init__.py index ae11328..8a9e701 100644 --- a/src/HttpLibrary/__init__.py +++ b/src/HttpLibrary/__init__.py @@ -3,6 +3,7 @@ from base64 import b64encode from functools import wraps from urlparse import urlparse +from webtest import utils import livetest import json @@ -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): From 536675b1bc400729adce3872eac59dfa111dd547 Mon Sep 17 00:00:00 2001 From: Viktoras Bezaras Date: Thu, 8 Aug 2013 11:42:20 +0200 Subject: [PATCH 2/2] Added Should Not Contain function --- src/HttpLibrary/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/HttpLibrary/__init__.py b/src/HttpLibrary/__init__.py index 8a9e701..b85aeed 100644 --- a/src/HttpLibrary/__init__.py +++ b/src/HttpLibrary/__init__.py @@ -490,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.