Les tests de code qui nécessite une Fiole application ou un contexte de demande

Je suis working outside of request context lorsque vous tentez d'accéder session dans un test. Comment puis-je configurer un contexte lorsque je teste quelque chose qui nécessite un?

import unittest
from flask import Flask, session

app = Flask(__name__)

@app.route('/')
def hello_world():
    t = Test()
    hello = t.hello()
    return hello

class Test:
    def hello(self):
        session['h'] = 'hello'
        return session['h']

class MyUnitTest(unittest.TestCase):
    def test_unit(self):
        t = tests.Test()
        t.hello()
InformationsquelleAutor Cory | 2013-06-29