From ce45349784e67f2ab498432692fbb0f54b5d5c54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com>
Date: Wed, 21 Nov 2012 09:36:49 +0100
Subject: [PATCH] Continue 43bb93dd8393b744bfa8acbfe29dd07b9affa85f

More things were destroyed in 7cec0b7527a71e434ec6fb52398827192f47c6db
---
 ...ubscription_requestUpdateOpenSaleOrder.xml |   1 +
 .../testSlapOSAccountingAlarm.py              | 116 +-----------------
 master/bt5/slapos_accounting/bt/revision      |   2 +-
 3 files changed, 8 insertions(+), 111 deletions(-)

diff --git a/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.xml b/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.xml
index 5c9ad6698..c89d4d4e4 100644
--- a/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.xml
+++ b/master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_requestUpdateOpenSaleOrder.xml
@@ -53,6 +53,7 @@
             <value> <string>person = context.getDestinationSectionValue()\n
 if person is not None:\n
   person.Person_storeOpenSaleOrderJournal()\n
+context.converge()\n
 </string> </value>
         </item>
         <item>
diff --git a/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingAlarm.py b/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingAlarm.py
index 4460a3aa2..4ebe84d79 100644
--- a/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingAlarm.py
+++ b/master/bt5/slapos_accounting/TestTemplateItem/testSlapOSAccountingAlarm.py
@@ -666,50 +666,10 @@ class TestOpenSaleOrderAlarm(testSlapOSMixin):
         for q in open_sale_order_template.getCategoryList()]))
 
   @simulateHostingSubscription_requestUpdateOpenSaleOrder
-  def test_alarm_HS_validated(self):
+  def test_alarm_HS_diverged(self):
     subscription = self.portal.hosting_subscription_module\
         .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
     subscription.edit(reference='TESTHS-%s' % self.generateNewId())
-    self.portal.portal_workflow._jumpToStateFor(subscription, 'validated')
-    self.tic()
-
-    self.portal.portal_alarms\
-        .slapos_request_update_hosting_subscription_open_sale_order\
-        .activeSense()
-    self.tic()
-    self.assertEqual(
-        'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
-        subscription.workflow_history['edit_workflow'][-1]['comment'])
-
-  @simulateHostingSubscription_requestUpdateOpenSaleOrder
-  def test_alarm_HS_validated_OSO_invalidated(self):
-    subscription = self.portal.hosting_subscription_module\
-        .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
-    subscription.edit(reference='TESTHS-%s' % self.generateNewId())
-    self.portal.portal_workflow._jumpToStateFor(subscription, 'validated')
-
-    open_sale_order = self.portal.open_sale_order_module\
-        .template_open_sale_order.Base_createCloneDocument(batch_mode=1)
-    open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
-    open_sale_order.newContent(portal_type='Open Sale Order Line',
-        aggregate=subscription.getRelativeUrl())
-    self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'invalidated')
-    self.tic()
-
-    self.portal.portal_alarms\
-        .slapos_request_update_hosting_subscription_open_sale_order\
-        .activeSense()
-    self.tic()
-    self.assertEqual(
-        'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
-        subscription.workflow_history['edit_workflow'][-1]['comment'])
-
-  @simulateHostingSubscription_requestUpdateOpenSaleOrder
-  def test_alarm_HS_archived(self):
-    subscription = self.portal.hosting_subscription_module\
-        .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
-    subscription.edit(reference='TESTHS-%s' % self.generateNewId())
-    self.portal.portal_workflow._jumpToStateFor(subscription, 'archived')
     self.tic()
 
     self.portal.portal_alarms\
@@ -720,75 +680,6 @@ class TestOpenSaleOrderAlarm(testSlapOSMixin):
         'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
         subscription.workflow_history['edit_workflow'][-1]['comment'])
 
-  @simulateHostingSubscription_requestUpdateOpenSaleOrder
-  def test_alarm_HS_archived_OSO_validated(self):
-    subscription = self.portal.hosting_subscription_module\
-        .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
-    subscription.edit(reference='TESTHS-%s' % self.generateNewId())
-    self.portal.portal_workflow._jumpToStateFor(subscription, 'archived')
-
-    open_sale_order = self.portal.open_sale_order_module\
-        .template_open_sale_order.Base_createCloneDocument(batch_mode=1)
-    open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
-    open_sale_order.newContent(portal_type='Open Sale Order Line',
-        aggregate=subscription.getRelativeUrl())
-    self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'validated')
-    self.tic()
-
-    self.portal.portal_alarms\
-        .slapos_request_update_hosting_subscription_open_sale_order\
-        .activeSense()
-    self.tic()
-    self.assertEqual(
-        'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
-        subscription.workflow_history['edit_workflow'][-1]['comment'])
-
-  @simulateHostingSubscription_requestUpdateOpenSaleOrder
-  def test_alarm_HS_validated_OSO_validated(self):
-    subscription = self.portal.hosting_subscription_module\
-        .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
-    subscription.edit(reference='TESTHS-%s' % self.generateNewId())
-    self.portal.portal_workflow._jumpToStateFor(subscription, 'validated')
-
-    open_sale_order = self.portal.open_sale_order_module\
-        .template_open_sale_order.Base_createCloneDocument(batch_mode=1)
-    open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
-    open_sale_order.newContent(portal_type='Open Sale Order Line',
-        aggregate=subscription.getRelativeUrl())
-    self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'validated')
-    self.tic()
-
-    self.portal.portal_alarms\
-        .slapos_request_update_hosting_subscription_open_sale_order\
-        .activeSense()
-    self.tic()
-    self.assertNotEqual(
-        'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
-        subscription.workflow_history['edit_workflow'][-1]['comment'])
-
-  @simulateHostingSubscription_requestUpdateOpenSaleOrder
-  def test_alarm_HS_archived_OSO_invalidated(self):
-    subscription = self.portal.hosting_subscription_module\
-        .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
-    subscription.edit(reference='TESTHS-%s' % self.generateNewId())
-    self.portal.portal_workflow._jumpToStateFor(subscription, 'archived')
-
-    open_sale_order = self.portal.open_sale_order_module\
-        .template_open_sale_order.Base_createCloneDocument(batch_mode=1)
-    open_sale_order.edit(reference='TESTOSO-%s' % self.generateNewId())
-    open_sale_order.newContent(portal_type='Open Sale Order Line',
-        aggregate=subscription.getRelativeUrl())
-    self.portal.portal_workflow._jumpToStateFor(open_sale_order, 'invalidated')
-    self.tic()
-
-    self.portal.portal_alarms\
-        .slapos_request_update_hosting_subscription_open_sale_order\
-        .activeSense()
-    self.tic()
-    self.assertNotEqual(
-        'Visited by HostingSubscription_requestUpdateOpenSaleOrder',
-        subscription.workflow_history['edit_workflow'][-1]['comment'])
-
 class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
   def test_empty_HostingSubscription(self):
     person = self.portal.person_module.template_member\
@@ -803,6 +694,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
 
     subscription.HostingSubscription_requestUpdateOpenSaleOrder()
     self.tic()
+    self.assertEqual(subscription.getCausalityState(), 'solved')
 
     open_sale_order_list = self.portal.portal_catalog(
         portal_type='Open Sale Order',
@@ -856,6 +748,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
 
     subscription.HostingSubscription_requestUpdateOpenSaleOrder()
     self.tic()
+    self.assertEqual(subscription.getCausalityState(), 'solved')
 
     open_sale_order_list = self.portal.portal_catalog(
         portal_type='Open Sale Order',
@@ -903,10 +796,12 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
         'time': destroy_time,
         'action': 'request_destroy'
     })
+    subscription.diverge()
     self.tic()
 
     subscription.HostingSubscription_requestUpdateOpenSaleOrder()
     self.tic()
+    self.assertEqual(subscription.getCausalityState(), 'solved')
 
     open_sale_order_list = self.portal.portal_catalog(
         portal_type='Open Sale Order',
@@ -984,6 +879,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
 
     subscription.HostingSubscription_requestUpdateOpenSaleOrder()
     self.tic()
+    self.assertEqual(subscription.getCausalityState(), 'solved')
 
     open_sale_order_list = self.portal.portal_catalog(
         portal_type='Open Sale Order',
diff --git a/master/bt5/slapos_accounting/bt/revision b/master/bt5/slapos_accounting/bt/revision
index 0aede4a00..0fd0714a5 100644
--- a/master/bt5/slapos_accounting/bt/revision
+++ b/master/bt5/slapos_accounting/bt/revision
@@ -1 +1 @@
-102
\ No newline at end of file
+103
\ No newline at end of file
-- 
2.30.9