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
Provenance
- Commit
001a512- Tree
b9dfdb9- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
f0c089f
1 file changed+19 added−15 removed
modified:tests/flask_tests.py+19 added-15 removed
93 unmodified lines94 assert 'Modules are deprecated' in str(entry['message'])95 return update_wrapper(new_f, f)96 97 98-class ContextTestCase(unittest.TestCase):98+class FlaskTestCase(unittest.TestCase):99+ pass100 101+102+class ContextTestCase(FlaskTestCase):103+104 def test_context_binding(self):105 app = flask.Flask(__name__)106 @app.route('/')107 def index():67 unmodified lines175 else:176 raise AssertionError('some kind of exception expected')177 178 175-class BasicFunctionalityTestCase(unittest.TestCase):179+class BasicFunctionalityTestCase(FlaskTestCase):180 181 def test_options_work(self):182 app = flask.Flask(__name__)183 @app.route('/', methods=['GET', 'POST'])847 unmodified lines1031 rv = c.post('/foo', data={}, follow_redirects=True)1032 self.assertEqual(rv.data, 'success')1033 1034 1031-class TestToolsTestCase(unittest.TestCase):1035+class TestToolsTestCase(FlaskTestCase):1036 1037 def test_session_transactions(self):1038 app = flask.Flask(__name__)1039 app.testing = True35 unmodified lines1075 with c.session_transaction():1076 self.assert_(req is flask.request._get_current_object())1077 1078 1075-class InstanceTestCase(unittest.TestCase):1079+class InstanceTestCase(FlaskTestCase):1080 1081 def test_explicit_instance_paths(self):1082 here = os.path.abspath(os.path.dirname(__file__))1083 try:82 unmodified lines1166 finally:1167 sys.modules['myapp'] = None1168 1169 1166-class JSONTestCase(unittest.TestCase):1170+class JSONTestCase(FlaskTestCase):1171 1172 def test_json_bad_requests(self):1173 app = flask.Flask(__name__)1174 @app.route('/json', methods=['POST'])67 unmodified lines1242 if not has_encoding('euc-kr'):1243 test_modified_url_encoding = None1244 1245 1242-class TemplatingTestCase(unittest.TestCase):1246+class TemplatingTestCase(FlaskTestCase):1247 1248 def test_context_processing(self):1249 app = flask.Flask(__name__)1250 @app.context_processor113 unmodified lines1364 rv = c.get('/')1365 assert rv.data == 'Hello Custom World!'1366 1367 1364-class ModuleTestCase(unittest.TestCase):1368+class ModuleTestCase(FlaskTestCase):1369 1370 @emits_module_deprecation_warning1371 def test_basic_module(self):1372 app = flask.Flask(__name__)217 unmodified lines1590 assert c.get('/foo/').data == 'index'1591 assert c.get('/foo/bar').data == 'bar'1592 1593 1590-class BlueprintTestCase(unittest.TestCase):1594+class BlueprintTestCase(FlaskTestCase):1595 1596 def test_blueprint_specific_error_handling(self):1597 frontend = flask.Blueprint('frontend', __name__)1598 backend = flask.Blueprint('backend', __name__)158 unmodified lines1757 self.assertEqual(c.get('/').data, '1')1758 self.assertEqual(c.get('/page/2').data, '2')1759 1760 1757-class SendfileTestCase(unittest.TestCase):1761+class SendfileTestCase(FlaskTestCase):1762 1763 def test_send_file_regular(self):1764 app = flask.Flask(__name__)1765 with app.test_request_context():91 unmodified lines1857 assert value == 'attachment'1858 assert options['filename'] == 'index.txt'1859 1860 1857-class LoggingTestCase(unittest.TestCase):1861+class LoggingTestCase(FlaskTestCase):1862 1863 def test_logger_cache(self):1864 app = flask.Flask(__name__)1865 logger1 = app.logger75 unmodified lines1941 assert rv.status_code == 5001942 assert rv.data == 'Hello Server Error'1943 1944 1941-class ConfigTestCase(unittest.TestCase):1945+class ConfigTestCase(FlaskTestCase):1946 1947 def common_object_test(self, app):1948 assert app.secret_key == 'devkey'1949 assert app.config['TEST_KEY'] == 'foo'51 unmodified lines2001 assert 0, 'expected config'2002 assert not app.config.from_pyfile('missing.cfg', silent=True)2003 2004 2001-class SubdomainTestCase(unittest.TestCase):2005+class SubdomainTestCase(FlaskTestCase):2006 2007 def test_basic_support(self):2008 app = flask.Flask(__name__)2009 app.config['SERVER_NAME'] = 'localhost'54 unmodified lines2064 rv = c.get('/outside', 'http://xtesting.localhost/')2065 assert rv.data == 'Outside'2066 2067 2064-class TestSignals(unittest.TestCase):2068+class TestSignals(FlaskTestCase):2069 2070 def test_template_rendered(self):2071 app = flask.Flask(__name__)2072 74 unmodified lines2147 finally:2148 flask.got_request_exception.disconnect(record, app)2149 2150 2147-class ViewTestCase(unittest.TestCase):2151+class ViewTestCase(FlaskTestCase):2152 2153 def common_test(self, app):2154 c = app.test_client()2155 66 unmodified lines2222 meths = parse_set_header(c.open('/', method='OPTIONS').headers['Allow'])2223 self.assertEqual(sorted(meths), ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST'])2224 2225 2222-class DeprecationsTestCase(unittest.TestCase):2226+class DeprecationsTestCase(FlaskTestCase):2227 2228 def test_init_jinja_globals(self):2229 class MyFlask(flask.Flask):2230 def init_jinja_globals(self):42 unmodified lines