test_restappinterface.py 文件源码

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

项目:floranet 作者: Fluent-networks 项目源码 文件源码
def test_get(self):
        """Test get method"""

        interface = self._test_azureiothttps()
        appif = self._test_appinterface()
        interface.appinterface = appif
        interfaceManager.interfaces = [interface]

        with patch.object(reqparse.RequestParser, 'parse_args'):
            resource = RestAppInterface(restapi=self.restapi, server=self.server)

            # Fail to find the app interface: raises 404 NotFound
            interfaceManager.getInterface = MagicMock(return_value=None)
            yield self.assertFailure(resource.get(1), e.NotFound)

            # Success finding the interface returns a dict of field values
            interfaceManager.getInterface = MagicMock(return_value=interface)
            result = yield resource.get(appif.id)
            self.assertEqual(interface.name, result['name'])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号