forked from orbit-oss/flask
Use assert_true instead of assert_
assert_ is deprecated which causes annoying warnings
This commit is contained in:
parent
5b89355b1c
commit
239780be28
12 changed files with 147 additions and 144 deletions
|
|
@ -48,8 +48,8 @@ class JSONTestCase(FlaskTestCase):
|
|||
rv = c.post('/json', data='malformed', content_type='application/json')
|
||||
self.assert_equal(rv.status_code, 400)
|
||||
self.assert_equal(rv.mimetype, 'application/json')
|
||||
self.assert_('description' in flask.json.loads(rv.data))
|
||||
self.assert_('<p>' not in flask.json.loads(rv.data)['description'])
|
||||
self.assert_true('description' in flask.json.loads(rv.data))
|
||||
self.assert_true('<p>' not in flask.json.loads(rv.data)['description'])
|
||||
|
||||
def test_json_body_encoding(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -167,7 +167,7 @@ class SendfileTestCase(FlaskTestCase):
|
|||
app = flask.Flask(__name__)
|
||||
with app.test_request_context():
|
||||
rv = flask.send_file('static/index.html')
|
||||
self.assert_(rv.direct_passthrough)
|
||||
self.assert_true(rv.direct_passthrough)
|
||||
self.assert_equal(rv.mimetype, 'text/html')
|
||||
with app.open_resource('static/index.html') as f:
|
||||
self.assert_equal(rv.data, f.read())
|
||||
|
|
@ -177,8 +177,8 @@ class SendfileTestCase(FlaskTestCase):
|
|||
app.use_x_sendfile = True
|
||||
with app.test_request_context():
|
||||
rv = flask.send_file('static/index.html')
|
||||
self.assert_(rv.direct_passthrough)
|
||||
self.assert_('x-sendfile' in rv.headers)
|
||||
self.assert_true(rv.direct_passthrough)
|
||||
self.assert_true('x-sendfile' in rv.headers)
|
||||
self.assert_equal(rv.headers['x-sendfile'],
|
||||
os.path.join(app.root_path, 'static/index.html'))
|
||||
self.assert_equal(rv.mimetype, 'text/html')
|
||||
|
|
@ -201,7 +201,7 @@ class SendfileTestCase(FlaskTestCase):
|
|||
f = open(os.path.join(app.root_path, 'static/index.html'))
|
||||
rv = flask.send_file(f)
|
||||
self.assert_equal(rv.mimetype, 'text/html')
|
||||
self.assert_('x-sendfile' in rv.headers)
|
||||
self.assert_true('x-sendfile' in rv.headers)
|
||||
self.assert_equal(rv.headers['x-sendfile'],
|
||||
os.path.join(app.root_path, 'static/index.html'))
|
||||
# mimetypes + etag
|
||||
|
|
@ -229,7 +229,7 @@ class SendfileTestCase(FlaskTestCase):
|
|||
with app.test_request_context():
|
||||
f = StringIO('Test')
|
||||
rv = flask.send_file(f)
|
||||
self.assert_('x-sendfile' not in rv.headers)
|
||||
self.assert_true('x-sendfile' not in rv.headers)
|
||||
# etags
|
||||
self.assert_equal(len(captured), 1)
|
||||
|
||||
|
|
@ -302,10 +302,10 @@ class LoggingTestCase(FlaskTestCase):
|
|||
def test_logger_cache(self):
|
||||
app = flask.Flask(__name__)
|
||||
logger1 = app.logger
|
||||
self.assert_(app.logger is logger1)
|
||||
self.assert_true(app.logger is logger1)
|
||||
self.assert_equal(logger1.name, __name__)
|
||||
app.logger_name = __name__ + '/test_logger_cache'
|
||||
self.assert_(app.logger is not logger1)
|
||||
self.assert_true(app.logger is not logger1)
|
||||
|
||||
def test_debug_log(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -325,10 +325,10 @@ class LoggingTestCase(FlaskTestCase):
|
|||
with catch_stderr() as err:
|
||||
c.get('/')
|
||||
out = err.getvalue()
|
||||
self.assert_('WARNING in helpers [' in out)
|
||||
self.assert_(os.path.basename(__file__.rsplit('.', 1)[0] + '.py') in out)
|
||||
self.assert_('the standard library is dead' in out)
|
||||
self.assert_('this is a debug statement' in out)
|
||||
self.assert_true('WARNING in helpers [' in out)
|
||||
self.assert_true(os.path.basename(__file__.rsplit('.', 1)[0] + '.py') in out)
|
||||
self.assert_true('the standard library is dead' in out)
|
||||
self.assert_true('this is a debug statement' in out)
|
||||
|
||||
with catch_stderr() as err:
|
||||
try:
|
||||
|
|
@ -336,7 +336,7 @@ class LoggingTestCase(FlaskTestCase):
|
|||
except ZeroDivisionError:
|
||||
pass
|
||||
else:
|
||||
self.assert_(False, 'debug log ate the exception')
|
||||
self.assert_true(False, 'debug log ate the exception')
|
||||
|
||||
def test_debug_log_override(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
@ -357,13 +357,13 @@ class LoggingTestCase(FlaskTestCase):
|
|||
|
||||
rv = app.test_client().get('/')
|
||||
self.assert_equal(rv.status_code, 500)
|
||||
self.assert_(b'Internal Server Error' in rv.data)
|
||||
self.assert_true(b'Internal Server Error' in rv.data)
|
||||
|
||||
err = out.getvalue()
|
||||
self.assert_('Exception on / [GET]' in err)
|
||||
self.assert_('Traceback (most recent call last):' in err)
|
||||
self.assert_('1/0' in err)
|
||||
self.assert_('ZeroDivisionError:' in err)
|
||||
self.assert_true('Exception on / [GET]' in err)
|
||||
self.assert_true('Traceback (most recent call last):' in err)
|
||||
self.assert_true('1/0' in err)
|
||||
self.assert_true('ZeroDivisionError:' in err)
|
||||
|
||||
def test_processor_exceptions(self):
|
||||
app = flask.Flask(__name__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue