How to use the webtest.debugapp.DebugApp function in WebTest

To help you get started, we’ve selected a few WebTest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Pylons / webtest / tests / test_forms.py View on Github external
def callFUT(self, body):
        app = DebugApp(form=to_bytes(body))
        return webtest.TestApp(app)
github Pylons / webtest / tests / test_forms.py View on Github external
def callFUT(self, filename='form_inputs.html'):
        dirname = os.path.join(os.path.dirname(__file__), 'html')
        app = DebugApp(form=os.path.join(dirname, filename), show_form=True)
        return webtest.TestApp(app)
github Pylons / webtest / tests / test_authorisation.py View on Github external
def callFUT(self):
        return webtest.TestApp(DebugApp())
github Pylons / webtest / webtest / debugapp.py View on Github external
header_name = str(header_name)
                    header_name = header_name.title()
                    headers.append((header_name, str(value)))

        resp = webob.Response()
        resp.status = status
        resp.headers.update(headers)
        if req.method != 'HEAD':
            if isinstance(body, six.text_type):
                resp.body = body.encode('utf8')
            else:
                resp.body = body
        return resp(environ, start_response)


debug_app = DebugApp(form=six.b('''
<form method="POST" action="/form-submit">
    <input type="text">
    <input value="Submit!" type="submit">
</form>'''))


def make_debug_app(global_conf, **local_conf):
    """An application that displays the request environment, and does
    nothing else (useful for debugging and test purposes).
    """
    return DebugApp(**local_conf)