本文整理汇总了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')