← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~rvb/maas/maas-transaction-request into lp:maas

 

Raphaël Badin has proposed merging lp:~rvb/maas/maas-transaction-request into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~rvb/maas/maas-transaction-request/+merge/96748

This branch adds the 'TransactionMiddleware' to the list of used middleware classes in settings.py.  The behavior is unfortunately untestable because this middleware only applies to the 'default' database and the tests operate on a 'test' database (see https://code.djangoproject.com/ticket/17168).

I've simply added a test to make sure that the middleware is in the list of the enabled middleware classes since this is required for the maasserver application to work as expected.

I would have wanted to add a test like this: http://paste.ubuntu.com/875941/.
-- 
https://code.launchpad.net/~rvb/maas/maas-transaction-request/+merge/96748
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~rvb/maas/maas-transaction-request into lp:maas.
=== modified file 'src/maas/settings.py'
--- src/maas/settings.py	2012-03-08 15:21:42 +0000
+++ src/maas/settings.py	2012-03-09 11:58:17 +0000
@@ -177,6 +177,7 @@
 MIDDLEWARE_CLASSES = (
     'django.middleware.common.CommonMiddleware',
     'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.transaction.TransactionMiddleware',
     'django.middleware.csrf.CsrfViewMiddleware',
     'django.middleware.csrf.CsrfResponseMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',

=== added file 'src/maasserver/tests/test_configuration.py'
--- src/maasserver/tests/test_configuration.py	1970-01-01 00:00:00 +0000
+++ src/maasserver/tests/test_configuration.py	2012-03-09 11:58:17 +0000
@@ -0,0 +1,27 @@
+# Copyright 2012 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+"""Tests configuration."""
+
+from __future__ import (
+    print_function,
+    unicode_literals,
+    )
+
+__metaclass__ = type
+__all__ = []
+
+
+from django.conf import settings
+from maasserver.testing import TestCase
+
+
+class TestConfiguration(TestCase):
+
+    def test_transactionmiddleware(self):
+        # The 'TransactionMiddleware' is enabled.
+        self.assertIn(
+            'django.middleware.transaction.TransactionMiddleware',
+            settings.MIDDLEWARE_CLASSES)
+
+