From 420b3422e4c05dd5c9ea8575eff237eb7b39c48f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Wed, 17 Jun 2009 08:28:44 +0000
Subject: [PATCH]  - add tests for default behaviour in case of empty category

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@27625 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5/tests/testBPMCore.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/product/ERP5/tests/testBPMCore.py b/product/ERP5/tests/testBPMCore.py
index fd7b72653b..9f25377894 100644
--- a/product/ERP5/tests/testBPMCore.py
+++ b/product/ERP5/tests/testBPMCore.py
@@ -2381,6 +2381,13 @@ class TestBPMImplementation(TestBPMMixin):
     self.assertEquals(node.getRelativeUrl(),
         business_path.getSource(default='something'))
 
+  def test_EmptyBusinessPathStandardCategoryAccessProvider(self):
+    business_path = self.createBusinessPath()
+    self.assertEquals(None, business_path.getSourceValue())
+    self.assertEquals(None, business_path.getSource())
+    self.assertEquals('something',
+        business_path.getSource(default='something'))
+
   def test_BuinessPathDynamicCategoryAccessProvider(self):
     node = self.portal.organisation_module.newContent(
                     portal_type='Organisation')
@@ -2397,6 +2404,19 @@ class TestBPMImplementation(TestBPMMixin):
     self.assertEquals(node.getRelativeUrl(),
       business_path.getSource(context=context_movement, default='something'))
 
+  def test_BuinessPathDynamicCategoryAccessProviderEmptyMovement(self):
+    business_path = self.createBusinessPath()
+    business_path.setSourceMethodId('BusinessPath_getDefaultSourceList')
+
+    context_movement = self.createMovement()
+    self.assertEquals(None, business_path.getSourceValue())
+    self.assertEquals(None,
+                      business_path.getSourceValue(context=context_movement))
+    self.assertEquals(None,
+                      business_path.getSource(context=context_movement))
+    self.assertEquals('something',
+      business_path.getSource(context=context_movement, default='something'))
+
   def test_BusinessState_getRemainingTradePhaseList(self):
     """
     This test case is described for what trade_phase is remaining after the state.
-- 
2.30.9