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

Proof that user with bad balance cannot request.

parent d0e5e870
......@@ -4,7 +4,7 @@ from testVifibSlapWebService import TestVifibSlapWebServiceMixin
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from random import random
from slapos import slap
from AccessControl import Unauthorized
from zExceptions import Unauthorized
from DateTime import DateTime
from Products.ERP5Type.tests.backportUnittest import skip
......@@ -128,17 +128,56 @@ class TestVifibSlapComputerPartitionLock(TestVifibSlapWebServiceMixin):
sla_xml=sequence.get('sla_xml'),
**kw)
def stepSoftwareInstanceSaleOrderConfirmRaisesUnauthorized(self, sequence,
**kw):
"""Checks that current software instance is realted only with sale order
and that this sale order cannot be confirmed because of Unauthorized
It means that user has bad balance."""
software_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
aggregate_value_list = software_instance.getAggregateRelatedValueList(
portal_type=[self.sale_packing_list_line_portal_type,
self.sale_order_line_portal_type])
self.assertEqual(1, len(aggregate_value_list))
self.assertTrue(self.sale_order_line_portal_type in [q.getPortalType() for\
q in aggregate_value_list])
sale_order_line = aggregate_value_list[0]
sale_order = sale_order_line.getParentValue()
self.assertRaises(Unauthorized, sale_order.confirm)
def stepAssertNoComputerPartition(self, sequence, **kw):
"""Sets in sequence computer partition parameters related to current
software instance"""
software_instance = self.portal.portal_catalog.getResultValue(
uid=sequence['software_instance_uid'])
delivery_line_list = [q for q in software_instance
.getAggregateRelatedValueList(
portal_type=self.sale_packing_list_line_portal_type)]
self.assertEqual(0, len(delivery_line_list))
def test_negative_person_balance_request(self):
"""Locked person can not request
"""
sequence_list = SequenceList()
sequence_string = \
self.prepare_installed_software_release_sequence_string + \
self.register_new_user_sequence_string + '\
self.register_new_user_sequence_string \
+ self.lock_user_string() + '\
LoginWebUser \
CheckPersonLockedState \
PersonRequestIsForbidden \
PersonRequestSoftwareInstance \
Tic \
Logout \
\
LoginDefaultUser \
SoftwareInstanceSaleOrderConfirmRaisesUnauthorized \
ConfirmOrderedSaleOrderActiveSense \
Tic \
AssertNoComputerPartition \
Logout \
\
LoginERP5TypeTestCase \
......
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