Commit 10597281 authored by Łukasz Nowak's avatar Łukasz Nowak

Assert stop_date in each case.

parent f3753a76
...@@ -288,6 +288,14 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): ...@@ -288,6 +288,14 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertEqual(1, len(open_sale_order_line_list)) self.assertEqual(1, len(open_sale_order_line_list))
line = open_sale_order_line_list[0].getObject() line = open_sale_order_line_list[0].getObject()
# calculate stop date to be after now, begin with start date with precision
# of month
stop_date = request_time
now = DateTime()
while stop_date < now:
stop_date = addToDate(stop_date, to_add={'month': 1})
self.assertEqual(stop_date, line.getStopDate())
self.assertEqual(subscription.getRelativeUrl(), line.getAggregate()) self.assertEqual(subscription.getRelativeUrl(), line.getAggregate())
open_sale_order_line_template = self.portal.restrictedTraverse( open_sale_order_line_template = self.portal.restrictedTraverse(
self.portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate()) self.portal.portal_preferences.getPreferredOpenSaleOrderLineTemplate())
...@@ -300,6 +308,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): ...@@ -300,6 +308,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertEqual(open_sale_order_line_template.getPrice(), self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice()) line.getPrice())
self.assertEqual(request_time, line.getStartDate()) self.assertEqual(request_time, line.getStartDate())
self.assertEqual(stop_date, line.getStopDate())
destroy_time = DateTime('2012/02/01') destroy_time = DateTime('2012/02/01')
subscription.workflow_history['instance_slap_interface_workflow'].append({ subscription.workflow_history['instance_slap_interface_workflow'].append({
...@@ -355,14 +364,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): ...@@ -355,14 +364,7 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertEqual(open_sale_order_line_template.getPrice(), self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice()) line.getPrice())
self.assertEqual(request_time, archived_line.getStartDate()) self.assertEqual(request_time, archived_line.getStartDate())
self.assertEqual(stop_date, line.getStopDate())
# calculate stop date to be after now, begin with start date with precision
# of month
stop_date = request_time
now = DateTime()
while stop_date < now:
stop_date = addToDate(stop_date, to_add={'month': 1})
self.assertEqual(stop_date, archived_line.getStopDate())
def test_lateAnalysed_HostingSubscription(self): def test_lateAnalysed_HostingSubscription(self):
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
...@@ -486,6 +488,14 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): ...@@ -486,6 +488,14 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
line.getPrice()) line.getPrice())
self.assertEqual(request_time, line.getStartDate()) self.assertEqual(request_time, line.getStartDate())
# calculate stop date to be after now, begin with start date with precision
# of month
stop_date = request_time
now = DateTime()
while stop_date < now:
stop_date = addToDate(stop_date, to_add={'month': 1})
self.assertEqual(stop_date, line.getStopDate())
subscription2 = self.portal.hosting_subscription_module\ subscription2 = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1) .template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
subscription2.edit(reference='TESTHS-%s' % self.generateNewId(), subscription2.edit(reference='TESTHS-%s' % self.generateNewId(),
...@@ -547,13 +557,6 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): ...@@ -547,13 +557,6 @@ class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
self.assertEqual(open_sale_order_line_template.getPrice(), self.assertEqual(open_sale_order_line_template.getPrice(),
line.getPrice()) line.getPrice())
self.assertEqual(request_time, archived_line.getStartDate()) self.assertEqual(request_time, archived_line.getStartDate())
# calculate stop date to be after now, begin with start date with precision
# of month
stop_date = request_time
now = DateTime()
while stop_date < now:
stop_date = addToDate(stop_date, to_add={'month': 1})
self.assertEqual(stop_date, archived_line.getStopDate()) self.assertEqual(stop_date, archived_line.getStopDate())
stop_date_2 = request_time_2 stop_date_2 = request_time_2
......
19 20
\ No newline at end of file \ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment