Fix static method parameter validation
Contract validation expected "this" parameter to be of either MuranoType or Murano object type. However for static method parameters it is MuranoTypeReference and this case wasn't handled Change-Id: I97b08b9383d47b6a66cff6db722e5467d0278f44 Closes-Bug: #1553186
This commit is contained in:
parent
74d6d2207c
commit
62ec96e374
|
@ -36,6 +36,8 @@ class Spec(object):
|
|||
if default is None:
|
||||
default = self.default
|
||||
executor = helpers.get_executor(context)
|
||||
if isinstance(this, dsl_types.MuranoTypeReference):
|
||||
this = this.type
|
||||
if isinstance(this, dsl_types.MuranoType):
|
||||
return self._contract.transform(
|
||||
value, executor.create_object_context(this),
|
||||
|
|
|
@ -39,8 +39,8 @@ Properties:
|
|||
Usage: Static
|
||||
|
||||
instanceProperty:
|
||||
Contract: $.string()
|
||||
Default: instanceProperty
|
||||
Contract: $.int()
|
||||
Default: 555
|
||||
|
||||
staticProperty2:
|
||||
Contract: $.string()
|
||||
|
@ -67,7 +67,7 @@ Methods:
|
|||
|
||||
testCallStaticMethodOnClassNameWithNs:
|
||||
Body:
|
||||
Return: ns:TestStatics.simpleStaticMethod()
|
||||
Return: ns:TestStatics.simpleStaticMethod($.instanceProperty)
|
||||
|
||||
testCallStaticMethodFromAnotherMethod:
|
||||
Body:
|
||||
|
@ -91,8 +91,12 @@ Methods:
|
|||
|
||||
simpleStaticMethod:
|
||||
Usage: Static
|
||||
Arguments:
|
||||
arg:
|
||||
Contract: $.int()
|
||||
Default: 0
|
||||
Body:
|
||||
Return: 123
|
||||
Return: 123 + $arg
|
||||
|
||||
simpleStaticMethod2:
|
||||
Usage: Static
|
||||
|
|
|
@ -57,7 +57,7 @@ class TestStatics(test_case.DslTestCase):
|
|||
|
||||
def test_call_static_method_on_class_name_with_ns(self):
|
||||
self.assertEqual(
|
||||
123, self._runner.testCallStaticMethodOnClassNameWithNs())
|
||||
678, self._runner.testCallStaticMethodOnClassNameWithNs())
|
||||
|
||||
def test_call_static_method_from_another_method(self):
|
||||
self.assertEqual(
|
||||
|
|
Loading…
Reference in New Issue