Commit 9277c236 authored by Romain Courteaud's avatar Romain Courteaud

Prevent calling HostingSubscription_requestUpdateOpenSaleOrder in URL.

parent 959edf00
...@@ -50,7 +50,11 @@ ...@@ -50,7 +50,11 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>if context.getCausalityState() != \'diverged\':\n <value> <string>from zExceptions import Unauthorized\n
if REQUEST is not None:\n
raise Unauthorized\n
\n
if context.getCausalityState() != \'diverged\':\n
return\n return\n
person = context.getDestinationSectionValue()\n person = context.getDestinationSectionValue()\n
if person is not None:\n if person is not None:\n
...@@ -60,7 +64,7 @@ context.converge()\n ...@@ -60,7 +64,7 @@ context.converge()\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string></string> </value> <value> <string>REQUEST=None</string> </value>
</item> </item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
......
...@@ -14,6 +14,7 @@ import os ...@@ -14,6 +14,7 @@ import os
import tempfile import tempfile
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.DateUtils import addToDate from Products.ERP5Type.DateUtils import addToDate
from zExceptions import Unauthorized
class Simulator: class Simulator:
def __init__(self, outfile, method, to_return=None): def __init__(self, outfile, method, to_return=None):
...@@ -748,6 +749,14 @@ class TestOpenSaleOrderAlarm(testSlapOSMixin): ...@@ -748,6 +749,14 @@ class TestOpenSaleOrderAlarm(testSlapOSMixin):
subscription.workflow_history['edit_workflow'][-1]['comment']) subscription.workflow_history['edit_workflow'][-1]['comment'])
class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin): class TestHostingSubscription_requestUpdateOpenSaleOrder(testSlapOSMixin):
def test_REQUEST_disallowed(self):
subscription = self.portal.hosting_subscription_module\
.template_hosting_subscription.Base_createCloneDocument(batch_mode=1)
self.assertRaises(
Unauthorized,
subscription.HostingSubscription_requestUpdateOpenSaleOrder,
REQUEST={})
def test_empty_HostingSubscription(self): def test_empty_HostingSubscription(self):
person = self.portal.person_module.template_member\ person = self.portal.person_module.template_member\
.Base_createCloneDocument(batch_mode=1) .Base_createCloneDocument(batch_mode=1)
......
205 206
\ 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