Skip to content
Myr

Refactored tests to use a different subclass

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Armin Ronacher · committed by Armin Ronacher · parent f0c089f · Browse files · 1 file+19 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+19 added−15 removed

  • tests:+19 added−15 removed

1 file+19 added−15 removed

modified:tests/flask_tests.py+19 added-15 removed
93 unmodified lines
94 assert 'Modules are deprecated' in str(entry['message'])95 return update_wrapper(new_f, f)969798class ContextTestCase(unittest.TestCase):98class FlaskTestCase(unittest.TestCase):99 pass100101102class ContextTestCase(FlaskTestCase):103104 def test_context_binding(self):105 app = flask.Flask(__name__)106 @app.route('/')107 def index():
67 unmodified lines
175 else:176 raise AssertionError('some kind of exception expected')177178175class BasicFunctionalityTestCase(unittest.TestCase):179class BasicFunctionalityTestCase(FlaskTestCase):180181 def test_options_work(self):182 app = flask.Flask(__name__)183 @app.route('/', methods=['GET', 'POST'])
847 unmodified lines
1031 rv = c.post('/foo', data={}, follow_redirects=True)1032 self.assertEqual(rv.data, 'success')103310341031class TestToolsTestCase(unittest.TestCase):1035class TestToolsTestCase(FlaskTestCase):10361037 def test_session_transactions(self):1038 app = flask.Flask(__name__)1039 app.testing = True
35 unmodified lines
1075 with c.session_transaction():1076 self.assert_(req is flask.request._get_current_object())107710781075class InstanceTestCase(unittest.TestCase):1079class InstanceTestCase(FlaskTestCase):10801081 def test_explicit_instance_paths(self):1082 here = os.path.abspath(os.path.dirname(__file__))1083 try:
82 unmodified lines
1166 finally:1167 sys.modules['myapp'] = None116811691166class JSONTestCase(unittest.TestCase):1170class JSONTestCase(FlaskTestCase):11711172 def test_json_bad_requests(self):1173 app = flask.Flask(__name__)1174 @app.route('/json', methods=['POST'])
67 unmodified lines
1242 if not has_encoding('euc-kr'):1243 test_modified_url_encoding = None124412451242class TemplatingTestCase(unittest.TestCase):1246class TemplatingTestCase(FlaskTestCase):12471248 def test_context_processing(self):1249 app = flask.Flask(__name__)1250 @app.context_processor
113 unmodified lines
1364 rv = c.get('/')1365 assert rv.data == 'Hello Custom World!'136613671364class ModuleTestCase(unittest.TestCase):1368class ModuleTestCase(FlaskTestCase):13691370 @emits_module_deprecation_warning1371 def test_basic_module(self):1372 app = flask.Flask(__name__)
217 unmodified lines
1590 assert c.get('/foo/').data == 'index'1591 assert c.get('/foo/bar').data == 'bar'159215931590class BlueprintTestCase(unittest.TestCase):1594class BlueprintTestCase(FlaskTestCase):15951596 def test_blueprint_specific_error_handling(self):1597 frontend = flask.Blueprint('frontend', __name__)1598 backend = flask.Blueprint('backend', __name__)
158 unmodified lines
1757 self.assertEqual(c.get('/').data, '1')1758 self.assertEqual(c.get('/page/2').data, '2')175917601757class SendfileTestCase(unittest.TestCase):1761class SendfileTestCase(FlaskTestCase):17621763 def test_send_file_regular(self):1764 app = flask.Flask(__name__)1765 with app.test_request_context():
91 unmodified lines
1857 assert value == 'attachment'1858 assert options['filename'] == 'index.txt'185918601857class LoggingTestCase(unittest.TestCase):1861class LoggingTestCase(FlaskTestCase):18621863 def test_logger_cache(self):1864 app = flask.Flask(__name__)1865 logger1 = app.logger
75 unmodified lines
1941 assert rv.status_code == 5001942 assert rv.data == 'Hello Server Error'194319441941class ConfigTestCase(unittest.TestCase):1945class ConfigTestCase(FlaskTestCase):19461947 def common_object_test(self, app):1948 assert app.secret_key == 'devkey'1949 assert app.config['TEST_KEY'] == 'foo'
51 unmodified lines
2001 assert 0, 'expected config'2002 assert not app.config.from_pyfile('missing.cfg', silent=True)200320042001class SubdomainTestCase(unittest.TestCase):2005class SubdomainTestCase(FlaskTestCase):20062007 def test_basic_support(self):2008 app = flask.Flask(__name__)2009 app.config['SERVER_NAME'] = 'localhost'
54 unmodified lines
2064 rv = c.get('/outside', 'http://xtesting.localhost/')2065 assert rv.data == 'Outside'206620672064class TestSignals(unittest.TestCase):2068class TestSignals(FlaskTestCase):20692070 def test_template_rendered(self):2071 app = flask.Flask(__name__)2072
74 unmodified lines
2147 finally:2148 flask.got_request_exception.disconnect(record, app)214921502147class ViewTestCase(unittest.TestCase):2151class ViewTestCase(FlaskTestCase):21522153 def common_test(self, app):2154 c = app.test_client()2155
66 unmodified lines
2222 meths = parse_set_header(c.open('/', method='OPTIONS').headers['Allow'])2223 self.assertEqual(sorted(meths), ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST'])222422252222class DeprecationsTestCase(unittest.TestCase):2226class DeprecationsTestCase(FlaskTestCase):22272228 def test_init_jinja_globals(self):2229 class MyFlask(flask.Flask):2230 def init_jinja_globals(self):
42 unmodified lines