Commit 8bfed59f authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_subscription_request: Remove unecessary script

   This script isn't used, and every custom project might overwrite it, so no need to keep it.
parent f47c83b0
from zExceptions import Unauthorized
if REQUEST is None:
raise Unauthorized
if REQUEST.other['method'] != "GET":
raise ValueError("Method is not GET but a " + REQUEST.other['method'])
if default_email_text is None:
raise ValueError("Please Provide some email!")
if name is None:
raise ValueError("Please Provide some name!")
if subscription_reference is None:
raise ValueError("Please Provide some subscription_reference!")
user_input_dict = {
"name": name,
"amount" : amount}
return context.SubscriptionRequestModule_requestSubscriptionProxy(
default_email_text, subscription_reference,
confirmation_required=bool(confirmation_required),
token=token, user_input_dict=user_input_dict,
variation_reference=variation_reference,
target_language=target_language, batch_mode=0)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>name=None, default_email_text=None, subscription_reference=None, amount=0, token=None, confirmation_required=True, variation_reference=None, target_language=None, REQUEST=None, **kw</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionRequestModule_requestSubscription</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -1111,7 +1111,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
kw["token"] = self.cloud_invitation_token.getId()
if self.resource_variation_reference is not None:
kw["variation_reference"] = self.resource_variation_reference
return self.web_site.hateoas.SubscriptionRequestModule_requestSubscription(**kw)
return self.web_site.hateoas.SubscriptionRequestModule_requestSubscriptionProxy(**kw)
@changeSkin('Hal')
def _requestSubscriptionViaChineseWebsite(self, **kw):
......@@ -1129,7 +1129,7 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.portal.portal_secure_payments.slapos_wechat_test.setWechatMode("UNITTEST")
self.logout()
self.changeSkin('Hal')
return self.web_site.hateoas.SubscriptionRequestModule_requestSubscription(**kw)
return self.web_site.hateoas.SubscriptionRequestModule_requestSubscriptionProxy(**kw)
finally:
self._dropPaymentTransaction_getVADSUrlDict()
self.portal.portal_secure_payments.slapos_wechat_test.setWechatMode(original_mode)
......@@ -1198,11 +1198,13 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
default_email_text):
self.logout()
user_input_dict = {
"name": name,
"amount" : amount}
self._requestSubscription(
subscription_reference=self.subscription_condition.getReference(),
amount=amount,
name=name,
default_email_text=default_email_text,
user_input_dict=user_input_dict,
email=default_email_text,
confirmation_required=False,
REQUEST=self.portal.REQUEST)
......@@ -1686,13 +1688,17 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
)
self.logout()
user_input_dict = {
"name": name,
"amount" : amount}
self._requestSubscription(
subscription_reference=self.subscription_condition.getReference(),
amount=amount,
name=name,
default_email_text=default_email_text,
user_input_dict=user_input_dict,
email=default_email_text,
confirmation_required=False,
REQUEST=self.portal.REQUEST)
self.login()
# I'm not sure if this is realistic
......@@ -1734,11 +1740,13 @@ return dict(vads_url_already_registered="%s/already_registered" % (payment_trans
self.logout()
# Request a second one, without require confirmation and verifing
# the second subscription request
user_input_dict = {
"name": name,
"amount" : amount}
self._requestSubscription(
subscription_reference=self.subscription_condition.getReference(),
amount=amount,
name=name,
default_email_text=default_email_text,
user_input_dict=user_input_dict,
email=default_email_text,
confirmation_required=False,
REQUEST=self.portal.REQUEST)
......
......@@ -214,45 +214,6 @@ class TestSubscriptionCondition_renderParameter(TestSubscriptionSkinsMixin):
subscription_condition.setTextContent(parameter_xml)
self.assertEqual(parameter_xml, subscription_condition.SubscriptionCondition_renderParameter(amount=1))
class TestSubscriptionRequestModule_requestSubscription(TestSubscriptionSkinsMixin):
@simulate('SubscriptionRequestModule_requestSubscriptionProxy', '*args, **kwargs','return args, kwargs')
def test_SubscriptionRequestModule_requestSubscription(self):
module = self.portal.subscription_request_module
# Request is None, so it can only be called via URL
self.assertRaises(Unauthorized, module.SubscriptionRequestModule_requestSubscription, REQUEST=None)
# Method is not get
self.assertRaises(ValueError, module.SubscriptionRequestModule_requestSubscription,
REQUEST=self.portal.REQUEST)
# Method is not get
self.portal.REQUEST.other['method'] = "GET"
# default_email_text not defined
self.assertRaises(ValueError, module.SubscriptionRequestModule_requestSubscription,
REQUEST=self.portal.REQUEST)
# name not defined
self.assertRaises(ValueError, module.SubscriptionRequestModule_requestSubscription,
REQUEST=self.portal.REQUEST, default_email_text="123@nexedi.com")
# subscription_reference not defined
self.assertRaises(ValueError, module.SubscriptionRequestModule_requestSubscription,
REQUEST=self.portal.REQUEST, default_email_text="123@nexedi.com",
name="couscous")
expected_argument_tuple = (('123@nexedi.com', 'subscription_reference'),
{'confirmation_required': True, 'user_input_dict': {'name': "couscous", 'amount': 0},
'variation_reference': None, 'target_language': None, 'token': None, 'batch_mode': 0})
self.assertEqual(expected_argument_tuple, module.SubscriptionRequestModule_requestSubscription(
REQUEST=self.portal.REQUEST, default_email_text="123@nexedi.com",
name="couscous", subscription_reference="subscription_reference"))
self.tic()
class TestSubscriptionRequest_init(TestSubscriptionSkinsMixin):
def test_SubscriptionRequest_init(self):
subscription_request = self.portal.subscription_request_module.newContent()
......
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