def test_callaction_param_mashal_out(self, mock_post):
"""
Values should be marshalled into the appropriate Python data types.
"""
ret = mock.Mock()
ret.text = """
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:GetGenericPortMappingEntryResponse xmlns:u="urn:schemas-upnp-org:service:Layer3Forwarding:1">
<NewInternalClient>10.0.0.1</NewInternalClient>
<NewExternalPort>51773</NewExternalPort>
<NewEnabled>true</NewEnabled>
</u:GetGenericPortMappingEntryResponse>
</s:Body>
</s:Envelope>
"""
mock_post.return_value = ret
action = self.server.find_action('GetGenericPortMappingEntry')
response = action(NewPortMappingIndex=0)
self.assertIsInstance(response['NewInternalClient'], basestring)
self.assertIsInstance(response['NewExternalPort'], int)
self.assertIsInstance(response['NewEnabled'], bool)
评论列表
文章目录