Commit ae610908 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_slap_tool: testSlapOSSlapTool use person.getUserId instead person.getReference

parent 11bdc499
......@@ -6,10 +6,22 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>SlapOSSlapTool</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>extension.erp5.SlapOSSlapTool</string> </value>
......@@ -43,13 +55,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -62,7 +89,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -71,7 +98,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.patches.WorkflowTool"/>
</pickle>
......
......@@ -2141,10 +2141,11 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
person.recursiveImmediateReindexObject()
self.person = person
self.person_reference = person.getReference()
self.person_user_id = person.getUserId()
TestSlapOSSlapToolMixin.afterSetUp(self, person=person)
def test_not_accessed_getComputerStatus(self):
self.login(self.person_reference)
self.login(self.person_user_id)
created_at = rfc1123_date(DateTime())
response = self.portal_slap.getComputerStatus(self.computer_id)
self.assertEqual(200, response.status)
......@@ -2185,7 +2186,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_accessed_getComputerStatus(self):
self.login(self.computer_id)
self.portal_slap.getFullComputerInformation(self.computer_id)
self.login(self.person_reference)
self.login(self.person_user_id)
created_at = rfc1123_date(DateTime())
response = self.portal_slap.getComputerStatus(self.computer_id)
self.assertEqual(200, response.status)
......@@ -2233,7 +2234,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
'recmethod': 'reportComputerBang'}])
def test_computerBang(self):
self.login(self.person_reference)
self.login(self.person_user_id)
self.computer_bang_simulator = tempfile.mkstemp()[1]
try:
self.computer.reportComputerBang = Simulator(
......@@ -2276,7 +2277,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_getComputerPartitionStatus(self):
self._makeComplexComputer()
self.login(self.person_reference)
self.login(self.person_user_id)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
created_at = rfc1123_date(DateTime())
......@@ -2319,13 +2320,13 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_getComputerPartitionStatus_visited(self):
self._makeComplexComputer(person=self.person)
self.login(self.person_reference)
self.login(self.person_user_id)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
created_at = rfc1123_date(DateTime())
self.login(self.start_requested_software_instance.getReference())
self.portal_slap.registerComputerPartition(self.computer_id, partition_id)
self.login(self.person_reference)
self.login(self.person_user_id)
response = self.portal_slap.getComputerPartitionStatus(self.computer_id,
partition_id)
self.assertEqual(200, response.status)
......@@ -2368,7 +2369,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self._makeComplexComputer(person=self.person, with_slave=True)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
self.login(self.person_reference)
self.login(self.person_user_id)
response = self.portal_slap.registerComputerPartition(self.computer_id, partition_id)
self.assertEqual(200, response.status)
self.assertEqual( 'public, max-age=1, stale-if-error=604800',
......@@ -2500,7 +2501,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self._makeComplexComputer(person=self.person)
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
self.login(self.person_reference)
self.login(self.person_user_id)
response = self.portal_slap.registerComputerPartition(self.computer_id, partition_id)
self.assertEqual(200, response.status)
self.assertEqual( 'public, max-age=1, stale-if-error=604800',
......@@ -2623,7 +2624,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
self.login(self.person_reference)
self.login(self.person_user_id)
self.start_requested_software_instance.bang = Simulator(
self.instance_bang_simulator, 'bang')
error_log = 'Please bang me'
......@@ -2676,7 +2677,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
try:
partition_id = self.start_requested_software_instance.getAggregateValue(
portal_type='Computer Partition').getReference()
self.login(self.person_reference)
self.login(self.person_user_id)
self.start_requested_software_instance.rename = Simulator(
self.instance_rename_simulator, 'rename')
new_name = 'new me'
......@@ -2700,7 +2701,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_request_withSlave(self):
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
self.login(self.person_user_id)
self.person.requestSoftwareInstance = Simulator(
self.instance_request_simulator, 'requestSoftwareInstance')
response = self.portal_slap.requestComputerPartition(
......@@ -2730,7 +2731,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_request(self):
self.instance_request_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
self.login(self.person_user_id)
self.person.requestSoftwareInstance = Simulator(
self.instance_request_simulator, 'requestSoftwareInstance')
response = self.portal_slap.requestComputerPartition(
......@@ -2766,7 +2767,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
self._makeComplexComputer(person=self.person)
self.start_requested_software_instance.updateLocalRolesOnSecurityGroups()
self.tic()
self.login(self.person_reference)
self.login(self.person_user_id)
response = self.portal_slap.requestComputerPartition(
software_release=self.start_requested_software_instance.getUrlString(),
software_type=self.start_requested_software_instance.getSourceReference(),
......@@ -2857,7 +2858,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_computerSupply(self):
self.computer_supply_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
self.login(self.person_user_id)
self.computer.requestSoftwareRelease = Simulator(
self.computer_supply_simulator, 'requestSoftwareRelease')
software_url = 'live_test_url_%s' % self.generateNewId()
......@@ -2884,7 +2885,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_requestComputer(self):
self.computer_request_computer_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
self.login(self.person_user_id)
self.person.requestComputer = Simulator(
self.computer_request_computer_simulator, 'requestComputer')
......@@ -2932,7 +2933,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_generateComputerCertificate(self):
self.generate_computer_certificate_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
self.login(self.person_user_id)
self.computer.generateCertificate = Simulator(
self.generate_computer_certificate_simulator,
'generateComputerCertificate')
......@@ -2979,7 +2980,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
def test_revokeComputerCertificate(self):
self.revoke_computer_certificate_simulator = tempfile.mkstemp()[1]
try:
self.login(self.person_reference)
self.login(self.person_user_id)
self.computer.revokeCertificate = Simulator(
self.revoke_computer_certificate_simulator,
'revokeComputerCertificate')
......@@ -2998,7 +2999,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
if preference.getPreferenceState() == 'global':
preference.setPreferredHateoasUrl('')
self.tic()
self.login(self.person_reference)
self.login(self.person_user_id)
self.assertRaises(NotFound, self.portal_slap.getHateoasUrl)
def test_getHateoasUrl(self):
......@@ -3008,7 +3009,7 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSSlapToolMixin):
if preference.getPreferenceState() == 'global':
preference.setPreferredHateoasUrl('foo')
self.tic()
self.login(self.person_reference)
self.login(self.person_user_id)
response = self.portal_slap.getHateoasUrl()
self.assertEqual(200, response.status)
self.assertEqual('foo', response.body)
......@@ -55,15 +55,15 @@
<string>W:1514, 13: Use of eval (eval-used)</string>
<string>W:1568, 13: Use of eval (eval-used)</string>
<string>W:1608, 13: Use of eval (eval-used)</string>
<string>W:2015, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)</string>
<string>W:2111, 13: Use of eval (eval-used)</string>
<string>W:2496, 13: Use of eval (eval-used)</string>
<string>W:2550, 13: Use of eval (eval-used)</string>
<string>W:2577, 13: Use of eval (eval-used)</string>
<string>W:2732, 13: Use of eval (eval-used)</string>
<string>W:2760, 13: Use of eval (eval-used)</string>
<string>W:2809, 13: Use of eval (eval-used)</string>
<string>W:2856, 13: Use of eval (eval-used)</string>
<string>W:2132, 2: Arguments number differs from overridden \'afterSetUp\' method (arguments-differ)</string>
<string>W:2229, 13: Use of eval (eval-used)</string>
<string>W:2614, 13: Use of eval (eval-used)</string>
<string>W:2668, 13: Use of eval (eval-used)</string>
<string>W:2695, 13: Use of eval (eval-used)</string>
<string>W:2850, 13: Use of eval (eval-used)</string>
<string>W:2878, 13: Use of eval (eval-used)</string>
<string>W:2927, 13: Use of eval (eval-used)</string>
<string>W:2974, 13: Use of eval (eval-used)</string>
</tuple>
</value>
</item>
......
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