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

Trust testSlapOSMixin

afterSetUp logs as superuser, do not repeat it.
parent 08b850fc
......@@ -23,7 +23,6 @@ def withAbort(func):
class TestDefaultInvoicingRule(testSlapOSMixin):
@withAbort
def test_simulation(self):
self.login()
from Products.ERP5.Document.SimulationMovement import SimulationMovement
SimulationMovement.original_getSimulationState = SimulationMovement\
.getSimulationState
......
......@@ -12,7 +12,6 @@ from Products.ERP5Type.DateUtils import addToDate
class TestHostingSubscriptionSimulation(testSlapOSMixin):
def _prepare(self):
self.login()
person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1)
self.subscription = self.portal.hosting_subscription_module\
......
52
\ No newline at end of file
53
\ No newline at end of file
......@@ -6,7 +6,6 @@ from Products.ERP5Type.tests.utils import createZODBPythonScript
class TestSlapOSCorePromiseSlapOSModuleIdGeneratorAlarm(testSlapOSMixin):
def test_Module_assertIdGenerator(self):
self.login()
module = self.portal.newContent(portal_type='Person Module',
id=str(self.generateNewId()),
id_generator='bad_id_generator')
......
......@@ -83,7 +83,6 @@ class TestSlapOSSecurityMixin(testSlapOSMixin):
class TestSlapOSComputerSecurity(TestSlapOSSecurityMixin):
def test_active(self):
self.login()
reference = self._generateRandomUniqueReference('Computer')
computer = self.portal.computer_module.newContent(portal_type='Computer',
......@@ -100,7 +99,6 @@ class TestSlapOSComputerSecurity(TestSlapOSSecurityMixin):
user.getGroups())
def test_inactive(self):
self.login()
reference = self._generateRandomUniqueReference('Computer')
computer = self.portal.computer_module.newContent(portal_type='Computer',
......@@ -112,7 +110,6 @@ class TestSlapOSComputerSecurity(TestSlapOSSecurityMixin):
class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
portal_type = 'Software Instance'
def test_active(self):
self.login()
reference = self._generateRandomUniqueReference(self.portal_type)
instance = self.portal.getDefaultModule(portal_type=self.portal_type)\
......@@ -148,7 +145,6 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
user.getGroups())
def test_inactive(self):
self.login()
reference = self._generateRandomUniqueReference(self.portal_type)
instance = self.portal.getDefaultModule(portal_type=self.portal_type)\
......@@ -159,7 +155,6 @@ class TestSlapOSSoftwareInstanceSecurity(TestSlapOSSecurityMixin):
class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
def test_active(self):
self.login()
password = str(random.random())
reference = self._generateRandomUniqueReference('Person')
person = self.portal.person_module.newContent(portal_type='Person',
......@@ -199,7 +194,6 @@ class TestSlapOSPersonSecurity(TestSlapOSSecurityMixin):
self.assertSameSet(['R-MEMBER', 'G-COMPANY'], user.getGroups())
def test_inactive(self):
self.login()
password = str(random.random())
reference = self._generateRandomUniqueReference('Person')
person = self.portal.person_module.newContent(portal_type='Person',
......
......@@ -34,7 +34,6 @@ from testSlapOSCloudSecurityGroup import TestSlapOSSecurityMixin
class TestSlapOSShadowPerson(TestSlapOSSecurityMixin):
def test_active(self):
self.login()
password = str(random.random())
reference = self._generateRandomUniqueReference('Person')
shadow_reference = 'SHADOW-%s' % reference
......@@ -55,7 +54,6 @@ class TestSlapOSShadowPerson(TestSlapOSSecurityMixin):
user.getGroups())
def test_inactive(self):
self.login()
password = str(random.random())
reference = self._generateRandomUniqueReference('Person')
shadow_reference = 'SHADOW-%s' % reference
......@@ -70,7 +68,6 @@ class TestSlapOSShadowPerson(TestSlapOSSecurityMixin):
class TestSlapOSShadowComputer(TestSlapOSSecurityMixin):
def test_active(self):
self.login()
reference = self._generateRandomUniqueReference('Computer')
shadow_reference = 'SHADOW-%s' % reference
......@@ -89,7 +86,6 @@ class TestSlapOSShadowComputer(TestSlapOSSecurityMixin):
user.getGroups())
def test_inactive(self):
self.login()
reference = self._generateRandomUniqueReference('Computer')
shadow_reference = 'SHADOW-%s' % reference
......@@ -103,7 +99,6 @@ class TestSlapOSShadowComputer(TestSlapOSSecurityMixin):
class TestSlapOSShadowSoftwareInstance(TestSlapOSSecurityMixin):
portal_type = 'Software Instance'
def test_active(self):
self.login()
reference = self._generateRandomUniqueReference(self.portal_type)
shadow_reference = 'SHADOW-%s' % reference
......@@ -122,7 +117,6 @@ class TestSlapOSShadowSoftwareInstance(TestSlapOSSecurityMixin):
user.getGroups())
def test_inactive(self):
self.login()
reference = self._generateRandomUniqueReference(self.portal_type)
shadow_reference = 'SHADOW-%s' % reference
......
......@@ -13,7 +13,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_no_free_partition(self):
self._makeTree()
self.login()
self.assertEqual(None, self.software_instance.getAggregateValue(
portal_type='Computer Partition'))
......@@ -23,7 +22,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_no_host_instance(self):
self._makeSlaveTree()
self.login()
self.assertEqual(None, self.software_instance.getAggregateValue(
portal_type='Computer Partition'))
......@@ -43,7 +41,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_free_partition(self):
self._makeTree()
self.login()
self._makeComputer()
self._installSoftware(self.computer,
......@@ -64,7 +61,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_host_instance(self):
self._makeSlaveTree()
self.login()
self._makeComputer()
self._allocateHost(self.requested_software_instance,
......@@ -78,7 +74,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_capacity_scope_close(self):
self._makeTree()
self.login()
self._makeComputer()
self._installSoftware(self.computer,
......@@ -94,7 +89,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_host_capacity_scope_close(self):
self._makeSlaveTree()
self.login()
self._makeComputer()
self._allocateHost(self.requested_software_instance,
......@@ -110,7 +104,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_allocation_scope_close(self):
self._makeTree()
self.login()
self._makeComputer()
self._installSoftware(self.computer,
......@@ -126,7 +119,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_host_allocation_scope_close(self):
self._makeSlaveTree()
self.login()
self._makeComputer()
self._allocateHost(self.requested_software_instance,
......@@ -142,7 +134,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_allocation_scope_open_personal(self):
self._makeTree()
self.login()
self._makeComputer()
self._installSoftware(self.computer,
......@@ -159,7 +150,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_host_allocation_scope_open_personal(self):
self._makeSlaveTree()
self.login()
self._makeComputer()
self._allocateHost(self.requested_software_instance,
......@@ -176,7 +166,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_allocation_scope_open_friend(self):
self._makeTree()
self.login()
self._makeComputer()
self._installSoftware(self.computer,
......@@ -209,7 +198,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_host_allocation_scope_open_friend(self):
self._makeSlaveTree()
self.login()
self._makeComputer()
self._allocateHost(self.requested_software_instance,
......@@ -242,7 +230,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_does_not_fail_on_instance_with_damaged_sla_xml(self):
self._makeTree()
self.login()
self.software_instance.setSlaXml('this is not xml')
self.assertEqual(None, self.software_instance.getAggregateValue(
......@@ -254,7 +241,6 @@ class TestSlapOSAllocation(testSlapOSMixin):
def test_allocation_does_not_fail_on_slave_with_damaged_sla_xml(self):
self._makeSlaveTree()
self.login()
self.software_instance.setSlaXml('this is not xml')
self.assertEqual(None, self.software_instance.getAggregateValue(
......@@ -284,7 +270,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_alarm_software_instance_unallocated(self):
self._makeTree()
self.login()
self._simulateSoftwareInstance_tryToAllocatePartition()
try:
......@@ -298,7 +283,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_alarm_slave_instance_unallocated(self):
self._makeSlaveTree()
self.login()
self._simulateSoftwareInstance_tryToAllocatePartition()
try:
......@@ -312,7 +296,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_alarm_software_instance_allocated(self):
self._makeTree()
self.login()
self._makeComputer()
self.software_instance.setAggregate(self.partition.getRelativeUrl())
......@@ -329,7 +312,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_alarm_slave_instance_allocated(self):
self._makeSlaveTree()
self.login()
self._makeComputer()
self.software_instance.setAggregate(self.partition.getRelativeUrl())
......@@ -346,7 +328,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_allocation_computer_guid(self):
self._makeTree()
self.login()
self._makeComputer()
self._installSoftware(self.computer,
......@@ -373,7 +354,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_allocation_instance_guid(self):
self._makeSlaveTree()
self.login()
self._makeComputer()
self._allocateHost(self.requested_software_instance,
......@@ -402,7 +382,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_allocation_network_guid(self):
self._makeTree()
self.login()
self._makeComputer()
new_id = self.generateNewId()
......@@ -439,7 +418,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def test_allocation_unexpected_sla_parameter(self):
self._makeTree()
self.login()
self._makeComputer()
self._installSoftware(self.computer,
......@@ -459,7 +437,6 @@ portal_workflow.doActionFor(context, action='edit_action', comment='Visited by S
def check_allocation_category_sla(self, base_category, computer_category,
other_category):
self._makeTree()
self.login()
self._makeComputer()
self.computer.edit(**{base_category: computer_category})
......
......@@ -11,7 +11,6 @@ class TestSlapOSCoreSlapOSAssertHostingSubscriptionPredecessorAlarm(
super(TestSlapOSCoreSlapOSAssertHostingSubscriptionPredecessorAlarm,
self).afterSetUp()
self._makeTree()
self.login()
def test_HostingSubscription_assertPredecessor(self):
self.software_instance.rename(new_name=self.generateNewSoftwareTitle())
......
......@@ -9,7 +9,6 @@ class TestSlapOSFreeComputerPartitionAlarm(testSlapOSMixin):
def afterSetUp(self):
super(TestSlapOSFreeComputerPartitionAlarm, self).afterSetUp()
self._makeTree()
self.login()
def test_Instance_tryToUnallocatePartition(self):
self._makeComputer()
......@@ -148,7 +147,6 @@ class TestSlapOSFreeComputerPartitionAlarmWithSlave(testSlapOSMixin):
def afterSetUp(self):
super(TestSlapOSFreeComputerPartitionAlarmWithSlave, self).afterSetUp()
self._makeTree(requested_template_id='template_slave_instance')
self.login()
def test_Instance_tryToUnallocatePartition(self):
self._makeComputer()
......
......@@ -9,7 +9,6 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(testSlapOSMixin):
def afterSetUp(self):
super(TestSlapOSGarbageCollectDestroyedRootTreeAlarm, self).afterSetUp()
self._makeTree()
self.login()
def test_Instance_tryToGarbageCollect(self):
self.hosting_subscription.archive()
......
......@@ -24,7 +24,6 @@ class TestSlapOSGarbageCollectDestroyedRootTreeAlarm(testSlapOSMixin):
'text': '#access ok'
})
transaction.commit()
self.login()
def test_Computer_checkAndUpdateCapacityScope(self):
self.computer.Computer_checkAndUpdateCapacityScope()
......
243
\ No newline at end of file
244
\ No newline at end of file
......@@ -6,7 +6,6 @@ import transaction
class TestSlapOSGroupRoleSecurityMixin(testSlapOSMixin):
def afterSetUp(self):
super(TestSlapOSGroupRoleSecurityMixin, self).afterSetUp()
self.login()
self.user_id = getSecurityManager().getUser().getId()
def beforeTearDown(self):
......
95
\ No newline at end of file
96
\ No newline at end of file
......@@ -63,7 +63,6 @@ class TestSlapOSSlapToolMixin(testSlapOSMixin):
class TestSlapOSSlapToolComputerAccess(TestSlapOSSlapToolMixin):
def test_getFullComputerInformation(self):
self.login()
self._makeComplexComputer(with_slave=True)
self.login(self.computer_id)
response = self.portal_slap.getFullComputerInformation(self.computer_id)
......@@ -1260,8 +1259,6 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def afterSetUp(self):
self.login()
password = self.generateNewId()
reference = 'test_%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person',
......@@ -1365,7 +1362,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'reportComputerBang'}])
def test_computerBang(self):
self.login()
self.login(self.person_reference)
self.computer_bang_simulator = tempfile.mkstemp()[1]
try:
......@@ -1408,7 +1404,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
os.unlink(self.computer_bang_simulator)
def test_getComputerPartitionStatus(self):
self.login()
self._makeComplexComputer()
self.login(self.person_reference)
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -1452,7 +1447,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_getComputerPartitionStatus_visited(self):
self.login()
self._makeComplexComputer(person=self.person)
self.login(self.person_reference)
partition_id = self.start_requested_software_instance.getAggregateValue(
......@@ -1500,7 +1494,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition_withSlave(self):
self.login()
self._makeComplexComputer(person=self.person, with_slave=True)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
......@@ -1615,7 +1608,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'\n'.join([q for q in difflib.unified_diff(expected_xml.split('\n'), got_xml.split('\n'))]))
def test_registerComputerPartition(self):
self.login()
self._makeComplexComputer(person=self.person)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
......@@ -1723,7 +1715,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'bang'}])
def test_softwareInstanceBang(self):
self.login()
self._makeComplexComputer(person=self.person)
self.instance_bang_simulator = tempfile.mkstemp()[1]
try:
......@@ -1777,7 +1768,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'rename'}])
def test_softwareInstanceRename(self):
self.login()
self._makeComplexComputer(person=self.person)
self.instance_rename_simulator = tempfile.mkstemp()[1]
try:
......@@ -1805,7 +1795,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'requestSoftwareInstance'}])
def test_request_withSlave(self):
self.login()
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
......@@ -1836,7 +1825,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
os.unlink(self.instance_request_simulator)
def test_request(self):
self.login()
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
......@@ -1876,7 +1864,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'requestSoftwareRelease'}])
def test_computerSupply(self):
self.login()
self.computer_supply_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
......@@ -1904,7 +1891,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'requestComputer'}])
def test_requestComputer(self):
self.login()
self.computer_request_computer_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
......@@ -1953,7 +1939,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'generateComputerCertificate'}])
def test_generateComputerCertificate(self):
self.login()
self.generate_computer_certificate_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
......@@ -2001,7 +1986,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'revokeComputerCertificate'}])
def test_revokeComputerCertificate(self):
self.login()
self.revoke_computer_certificate_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
......
......@@ -23,8 +23,6 @@ class TestSlapOSCoreComputerUpdateFromDict(testSlapOSMixin):
portal_type='Computer Partition')
self.assertEqual(len(partition_list), 0)
self.login()
def beforeTearDown(self):
transaction.abort()
......
17
\ No newline at end of file
18
\ 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