Description: disable certain unittests by environment
 This patch allows to set the environment variable DEB_NETWORK_TESTS to 
 "disabled" which will cause certain tests that rely on networking 
 (loopback interface) to be skipped. This is used for the webhook tests
 by now.
Author: Michael Fladischer <FladischerMichael@fladi.at>
Last-Update: 2012-05-20
Forwarded: not-needed

--- a/djcelery/tests/test_views.py
+++ b/djcelery/tests/test_views.py
@@ -1,12 +1,14 @@
 from __future__ import absolute_import
 
 import sys
+import os
 
 from functools import partial
 
 from django.core.urlresolvers import reverse
 from django.http import HttpResponse
 from django.test.testcases import TestCase as DjangoTestCase
+from django.utils.unittest import skipIf
 from django.template import TemplateDoesNotExist
 
 from anyjson import deserialize
@@ -120,6 +122,7 @@
 
 class test_webhook_task(ViewTestCase):
 
+    @skipIf(os.environ.get("DEB_NETWORK_TESTS", False) == "disabled", "network tests disabled by environment")
     def test_successful_request(self):
 
         @task_webhook
@@ -133,6 +136,7 @@
         self.assertDictContainsSubset({"status": "success", "retval": 20},
                                       deserialize(response.content))
 
+    @skipIf(os.environ.get("DEB_NETWORK_TESTS", False) == "disabled", "network tests disabled by environment")
     def test_failed_request(self):
 
         @task_webhook
