I want to test some routes but when i run nosetests it writes error
"TemplateNotFound: main.html"
I have render_templates = False
in my flask test Class.
For example i want to test this endpoint
@users.route('/test', methods=['GET','POST'])
def test():
return render_template('main.html')
I made test.py file with this TestCase
class TestConfig(object):
DEBUG = False
TESTING = True
WTF_CSRF_ENABLED = False
PRESERVE_CONTEXT_ON_EXCEPTION = False
SECRET_KEY = "sekret_key"
template_folder = "/home/project_name/templates"
class TestNotRenderTemplates(TestCase):
render_templates = False
def create_app(self):
app = Flask(__name__)
app = create_app(TestConfig)
return app
def test_assert_mytemplate_used(self):
response = self.client.get("/u/test")
self.assert_template_used('main.html')