Created
July 28, 2015 11:00
-
-
Save bekatom/c77925048fbc6c6c8ca9 to your computer and use it in GitHub Desktop.
flask-test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from flask import Flask | |
| from flask.ext.testing import TestCase | |
| from mtportal.app import create_app | |
| class TestConfig(object): | |
| DEBUG = False | |
| TESTING = True | |
| WTF_CSRF_ENABLED = False | |
| PRESERVE_CONTEXT_ON_EXCEPTION = False | |
| SECRET_KEY = "81848C15A27A88BEA1A1B6E377942" | |
| SECURITY_PASSWORD_SALT = "247E4B54E45E8" | |
| template_folder = "C:/Users/Beka/Projects/metatech-portal/mtportal/templates" | |
| class TestNotRenderTemplates(TestCase): | |
| render_templates = False | |
| def create_app(self): | |
| app = Flask(__name__) | |
| # create application config | |
| app = create_app(TestConfig) | |
| print app.config | |
| return app | |
| def test_assert_mytemplate_used(self): | |
| response = self.client.get("/u/test") | |
| self.assert_template_used('main.html') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment