Update request_context

This commit is contained in:
Kfir Hadas 2017-08-03 00:39:43 +03:00
parent 0f2a3c4555
commit fc226ed5f6
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
""" Sets up helper class for testing """ """ Sets up helper class for testing """
import os import os.path as op
import unittest import unittest
from nyaa import create_app from nyaa import create_app
@ -20,7 +20,7 @@ class NyaaTestCase(unittest.TestCase):
# cls.db_name = 'nyaav2_tests' # cls.db_name = 'nyaav2_tests'
# db_uri = 'mysql://root:@localhost/{}?charset=utf8mb4'.format(cls.db_name) # db_uri = 'mysql://root:@localhost/{}?charset=utf8mb4'.format(cls.db_name)
# else: # else:
# cls.db_name = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'test.db') # cls.db_name = op.abspath(op.join(op.dirname(__file__)), 'test.db')
# db_uri = 'sqlite:///{}?check_same_thread=False'.format(cls.db_name) # db_uri = 'sqlite:///{}?check_same_thread=False'.format(cls.db_name)
# if not os.environ.get('TRAVIS'): # Travis doesn't need a seperate DB # if not os.environ.get('TRAVIS'): # Travis doesn't need a seperate DB
@ -29,7 +29,7 @@ class NyaaTestCase(unittest.TestCase):
cls.app = app cls.app = app
cls.app_context = app.app_context() cls.app_context = app.app_context()
cls.request_context = app.test_request_context() cls.request_context = app.test_request_context
with cls.app_context: with cls.app_context:
cls.client = app.test_client() cls.client = app.test_client()

View File

@ -17,7 +17,7 @@ class TestTemplateUtils(NyaaTestCase):
pass pass
def test_static_cachebuster(self): def test_static_cachebuster(self):
with self.request_context: with self.request_context():
# Save this value in order to restore it in the end. # Save this value in order to restore it in the end.
orig_debug = self.app.debug orig_debug = self.app.debug