From f0817fe7f3f14e2a589a54994af1acc85f9d4ea7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Tue, 20 Sep 2011 16:39:15 +0200
Subject: [PATCH] Detect live tests and do some no-ops then.

---
 master/product/Vifib/tests/VifibMixin.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/master/product/Vifib/tests/VifibMixin.py b/master/product/Vifib/tests/VifibMixin.py
index b5070cec2..ce80d14f1 100644
--- a/master/product/Vifib/tests/VifibMixin.py
+++ b/master/product/Vifib/tests/VifibMixin.py
@@ -134,8 +134,15 @@ class testVifibMixin(ERP5TypeTestCase):
     user = uf.getUserById('default_user').__of__(uf)
     newSecurityManager(None, user)
 
+  def isLiveTest(self):
+    return 'ERP5TypeLiveTestCase' in [q.__name__ for q in self.__class__.mro()]
+
   def setupPortalCertificateAuthority(self):
     """Sets up portal_certificate_authority"""
+    if self.isLiveTest():
+      # nothing to do in case of being called as live test
+      return
+
     if not self.portal.hasObject('portal_certificate_authority'):
       self.portal.manage_addProduct['Vifib'].manage_addTool(
         'ERP5 Certificate Authority Tool', None)
@@ -256,6 +263,9 @@ class testVifibMixin(ERP5TypeTestCase):
     """
     Manager has to create an administrator user first.
     """
+    if self.isLiveTest():
+      # nothing to do in Live Test
+      return
     portal = self.getPortal()
     if 'MailHost' in portal.objectIds():
       portal.manage_delObjects(['MailHost'])
-- 
2.30.9