当前位置: 首页>>代码示例>>Python>>正文


Python Plugin._parse_request方法代码示例

本文整理汇总了Python中xbmcswift2.Plugin._parse_request方法的典型用法代码示例。如果您正苦于以下问题:Python Plugin._parse_request方法的具体用法?Python Plugin._parse_request怎么用?Python Plugin._parse_request使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xbmcswift2.Plugin的用法示例。


在下文中一共展示了Plugin._parse_request方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: TestParseRequest

# 需要导入模块: from xbmcswift2 import Plugin [as 别名]
# 或者: from xbmcswift2.Plugin import _parse_request [as 别名]
class TestParseRequest(TestCase):

    def setUp(self):
        name = 'Hello XBMC'
        plugin_id = 'plugin.video.helloxbmc'
        path = os.path.join(os.path.dirname(__file__), 'data', 'plugin', 'addon.py')
        with preserve_cwd(os.path.dirname(path)):
            self.plugin = Plugin(name, plugin_id, path)

    def test_parse_request(self):
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc', '0', '?']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc?', '0')

    def test_parse_request_no_qs(self):
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc', '0']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc', '0')

    def test_parse_request_path_in_arg0(self):
        # Older versions of xbmc sometimes pass path in arg0
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc/videos/', '0', '?foo=bar']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc/videos/?foo=bar', '0')

    def test_parse_request_path_in_arg2(self):
        # Older versions of xbmc sometimes pass path in arg2
        with patch('xbmcswift2.plugin.Request') as MockRequest:
            sys.argv = ['plugin://plugin.video.helloxbmc', '0', '/videos/?foo=bar']
            self.plugin._parse_request()
            MockRequest.assert_called_with('plugin://plugin.video.helloxbmc/videos/?foo=bar', '0')
开发者ID:dukavi,项目名称:xbmcswift2,代码行数:36,代码来源:test_plugin.py


注:本文中的xbmcswift2.Plugin._parse_request方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。