Commits

Christopher Grebs  committed 2e88228

Fixed the order of in which templates are appended to be able to recall the real request/response cycle

  • Participants
  • Parent commits 254a1e4

Comments (0)

Files changed (2)

File flaskext/testing.py

             template_rendered.connect(self._add_template)
 
     def _add_template(self, app, template, context):
-        self.templates.append((template, context))
+        self.templates.insert(0, (template, context))
 
     def _post_teardown(self):
         if self._ctx is not None:

File tests/__init__.py

     def index_with_template():
         return render_template("index.html", name="test")
 
+    @app.route("/template2/")
+    def index_with_template2():
+        return render_template("index.html", name="foobar")
+
     @app.route("/oops/")
     def bad_url():
         abort(404)
         except RuntimeError:
             pass
 
+    def test_get_recent_context_variable(self):
+        try:
+            self.client.get("/template/")
+            self.client.get("/template2/")
+            assert self.get_context_variable("name") == "foobar"
+        except RuntimeError:
+            pass
+
     def test_assert_context(self):
 
         try: