test_upnpclient.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:upnpclient 作者: flyte 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号