コード例 #1
0
def test_after_start():
    res = do_request(after_start_response_app, 200)
    res = strip_html(str(res))
    assert 'ValueError: error2' in res
    # This assertion assumes that the start_response_app returns on line 45
    # of this file.
    assert ':48' in res
コード例 #2
0
def test_after_start():
    res = do_request(after_start_response_app, 200)
    res = strip_html(str(res))
    assert 'ValueError: error2' in res
	# This assertion assumes that the start_response_app returns on line 45
	# of this file.
    assert ':48' in res
コード例 #3
0
def test_makes_exception():
    res = do_request(bad_app)
    assert '<html' in res
    res = strip_html(str(res.body))
    assert 'bad_app() takes no arguments (2 given' in res
    assert 'application(environ, sr_checker)' in res
    assert 'webtest.lint' in res
    assert 'weberror.errormiddleware' in res
コード例 #4
0
def test_makes_exception():
    res = do_request(bad_app)
    assert '<html' in res
    res = strip_html(str(res.body))
    assert 'bad_app() takes no arguments (2 given' in res
    assert 'application(environ, sr_checker)' in res
    assert 'webtest.lint' in res
    assert 'weberror.errormiddleware' in res
コード例 #5
0
def test_makes_exception():
    res = do_request(bad_app)
    assert '<html' in res
    res = strip_html(str(res))
    #print res
    assert 'bad_app() takes no arguments (2 given' in res
    assert 'iterator = application(environ, start_response_wrapper)' in res
    assert 'paste.lint' in res
    assert 'paste.exceptions.errormiddleware' in res
コード例 #6
0
def test_makes_exception():
    res = do_request(bad_app)
    assert '<html' in res
    res = strip_html(str(res))
    #print res
    assert 'bad_app() takes no arguments (2 given' in res
    assert 'iterator = application(environ, start_response_wrapper)' in res
    assert 'paste.lint' in res
    assert 'paste.exceptions.errormiddleware' in res
コード例 #7
0
def test_start_res():
    res = do_request(start_response_app)
    res = strip_html(str(res))
    #print res
    assert 'ValueError: hi' in res
    assert 'test_error_middleware' in res
    # This assertion assumes that the start_response_app returns on line 45
    # of this file.
    assert ':44 in start_response_app' in res
コード例 #8
0
def test_start_res():
    res = do_request(start_response_app)
    res = strip_html(str(res))
    #print res
    assert 'ValueError: hi' in res
    assert 'test_error_middleware' in res
	# This assertion assumes that the start_response_app returns on line 45
	# of this file.
    assert ':44 in start_response_app' in res
def test_makes_exception():
    res = do_request(bad_app)
    assert '<html' in res
    res = strip_html(str(res))
    if six.PY3:
        assert 'bad_app() takes 0 positional arguments but 2 were given' in res
    else:
        assert 'bad_app() takes no arguments (2 given' in res, repr(res)
    assert 'iterator = application(environ, start_response_wrapper)' in res
    assert 'paste.lint' in res
    assert 'paste.exceptions.errormiddleware' in res
コード例 #10
0
def test_hide_after():
    for f in formats:
        try:
            pass_through(
                'AABB',
                hide,
                'after',
                pass_through,
                'CCDD',
                # A little whitespace to keep this line out of the
                # content part of the report
                hide,
                'reset',
                raise_error)
        except:
            result = format(f)
            print strip_html(result).encode('ascii', 'replace')
            assert 'AABB' in result
            assert 'CCDD' not in result
            assert 'raise_error' in result
        else:
            assert 0
コード例 #11
0
def test_hide_after():
    for f in formats:
        try:
            pass_through(
                "AABB",
                hide,
                "after",
                pass_through,
                "CCDD",
                # A little whitespace to keep this line out of the
                # content part of the report
                hide,
                "reset",
                raise_error,
            )
        except:
            result = format(f)
            print strip_html(result).encode("ascii", "replace")
            assert "AABB" in result
            assert "CCDD" not in result
            assert "raise_error" in result
        else:
            assert 0
コード例 #12
0
ファイル: test_formatter.py プロジェクト: terrasea/paste
def test_hide_after():
    for f in formats:
        try:
            pass_through(
                'AABB',
                hide, 'after',
                pass_through, 'CCDD',
                # A little whitespace to keep this line out of the
                # content part of the report


                hide, 'reset',
                raise_error)
        except:
            result = format(f)
            print(strip_html(result).encode('ascii', 'replace'))
            assert 'AABB' in result
            assert 'CCDD' not in result
            assert 'raise_error' in result
        else:
            assert 0
コード例 #13
0
 def plain(self, environ):
     """ text/plain representation of the exception """
     body = self.make_body(environ, strip_html(self.template), no_quote)
     return ('%s %s\r\n%s\r\n' % (self.code, self.title, body))
コード例 #14
0
ファイル: httpexceptions.py プロジェクト: 10sr/hue
 def plain(self, environ):
     """ text/plain representation of the exception """
     body = self.make_body(environ, strip_html(self.template), no_quote, comment_quote)
     return ('%s %s\r\n%s\r\n' % (self.code, self.title, body))
コード例 #15
0
def test_start_res():
    res = do_request(start_response_app)
    res = strip_html(str(res))
    assert 'ValueError: hi' in res
    assert 'test_error_middleware' in res
    assert ':52 in start_response_app' in res
コード例 #16
0
def test_after_start():
    res = do_request(after_start_response_app, 200)
    res = strip_html(str(res))
    #print res
    assert 'ValueError: error2' in res
コード例 #17
0
def test_start_res():
    res = do_request(start_response_app)
    res = strip_html(str(res))
    assert 'ValueError: hi' in res
    assert 'test_error_middleware' in res
    assert ':52 in start_response_app' in res
コード例 #18
0
def test_after_start():
    res = do_request(after_start_response_app, 200)
    res = strip_html(str(res))
    #print res
    assert 'ValueError: error2' in res