From 75667df847f0b5f134903d7239dd99e46c76cbaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Mon, 27 Jun 2011 17:52:44 +0200
Subject: [PATCH] Validate required notification messages.

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

diff --git a/master/product/Vifib/tests/VifibMixin.py b/master/product/Vifib/tests/VifibMixin.py
index 2773ccec8..8b7f15361 100644
--- a/master/product/Vifib/tests/VifibMixin.py
+++ b/master/product/Vifib/tests/VifibMixin.py
@@ -41,6 +41,9 @@ REQUIRED_RULE_REFERENCE_LIST = [
   'default_order_rule',
 ]
 
+REQUIRED_NOTIFICATION_MESSAGE_REFERENCE_LIST = [
+  'crendential_request-confirmation-without-password',
+]
 
 class testVifibMixin(ERP5TypeTestCase):
   """
@@ -183,6 +186,17 @@ class testVifibMixin(ERP5TypeTestCase):
     if default_system_preference.getPreferenceState() == 'disabled':
       default_system_preference.enable()
 
+  def setupNotificationModule(self):
+    module = self.portal.notification_message_module
+    isTransitionPossible = self.portal.portal_workflow.isTransitionPossible
+
+    for reference in REQUIRED_NOTIFICATION_MESSAGE_REFERENCE_LIST:
+      for message in module.searchFolder(portal_type='Notification Message',
+        reference=reference):
+        message = message.getObject()
+        if isTransitionPossible(message, 'validate'):
+          message.validate()
+
   def setupRuleTool(self):
     """Validates newest version of each rule from REQUIRED_RULE_REFERENCE_LIST"""
     rule_tool = self.portal.portal_rules
@@ -252,6 +266,7 @@ class testVifibMixin(ERP5TypeTestCase):
     self.setPreference()
     self.setSystemPreference()
     self.setupRuleTool()
+    self.setupNotificationModule()
     self.openAssignments()
     transaction.commit()
     self.tic()
-- 
2.30.9