Commit 78b9e311 authored by Romain Courteaud's avatar Romain Courteaud

slapos_subscription_request: drop SubscriptionCondition_renderParameter

parent 7fa55f14
......@@ -12,13 +12,6 @@ def SubscriptionRequest_getTransactionalUser(self, REQUEST=None):
raise Unauthorized
return getTransactionalVariable().get("transactional_user", None)
def SubscriptionCondition_renderParameter(self, amount=0, **kw):
method_id = self.getParameterTemplateRendererMethodId()
if method_id is not None:
return getattr(self, method_id)(amount=amount, **kw)
return self.getTextContent()
def SubscriptionRequest_searchExistingUserByEmail(self, email, REQUEST=None):
if REQUEST is not None:
raise Unauthorized
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>SubscriptionCondition_renderParameter</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>SlapOSSubscriptionRequest</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SubscriptionCondition_renderParameter</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -104,38 +104,6 @@ class TestSubscriptionSkinsMixin(SlapOSTestCaseMixinWithAbort):
return subscription_request
class TestSubscriptionCondition_renderParameter(TestSubscriptionSkinsMixin):
@simulate('SubscriptionCondition_renderParameterSampleScript', '*args, **kwargs','return args, kwargs')
def test_call_script(self):
subscription_condition = self.newSubscriptionCondition()
subscription_condition.setParameterTemplateRendererMethodId("SubscriptionCondition_renderParameterSampleScript")
self.assertEqual(((), {'amount': 1}), subscription_condition.SubscriptionCondition_renderParameter(amount=1))
def test_script_is_not_set(self):
parameter_xml = """<?xml version="1.0" encoding="utf-8"?>
<instance>
<parameter id="_">{
"kvm-partition-dict": {
"KVM0": {
"cpu-count": 40,
"cpu-max-count": 41,
"ram-size": 245760,
"ram-max-size": 245761,
"disk-device-path": "/dev/sdb",
"project-guid": "PROJ-XXXX",
"disable-ansible-promise": true
}
}
}</parameter>
</instance>"""
subscription_condition = self.newSubscriptionCondition()
self.assertEqual(None, subscription_condition.SubscriptionCondition_renderParameter(amount=1))
subscription_condition.setTextContent(parameter_xml)
self.assertEqual(parameter_xml, subscription_condition.SubscriptionCondition_renderParameter(amount=1))
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