本文整理汇总了Python中YouTubePlaylistControl.YouTubePlaylistControl.addToPlaylist方法的典型用法代码示例。如果您正苦于以下问题:Python YouTubePlaylistControl.addToPlaylist方法的具体用法?Python YouTubePlaylistControl.addToPlaylist怎么用?Python YouTubePlaylistControl.addToPlaylist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类YouTubePlaylistControl.YouTubePlaylistControl
的用法示例。
在下文中一共展示了YouTubePlaylistControl.addToPlaylist方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_addToPlaylist_should_call_core_add_to_playlist_if_playlist_is_in_params
# 需要导入模块: from YouTubePlaylistControl import YouTubePlaylistControl [as 别名]
# 或者: from YouTubePlaylistControl.YouTubePlaylistControl import addToPlaylist [as 别名]
def test_addToPlaylist_should_call_core_add_to_playlist_if_playlist_is_in_params(self):
control = YouTubePlaylistControl()
control.createPlayList = Mock()
control.addToPlaylist({"playlist":"playlist1"})
sys.modules["__main__"].core.add_to_playlist.assert_called_with({'playlist': 'playlist1'})
示例2: test_addToPlaylist_should_call_list_all_if_playlist_is_not_in_params
# 需要导入模块: from YouTubePlaylistControl import YouTubePlaylistControl [as 别名]
# 或者: from YouTubePlaylistControl.YouTubePlaylistControl import addToPlaylist [as 别名]
def test_addToPlaylist_should_call_list_all_if_playlist_is_not_in_params(self):
sys.modules["__main__"].feeds.listAll.return_value = ([])
control = YouTubePlaylistControl()
control.addToPlaylist({})
sys.modules["__main__"].feeds.listAll.assert_called_with({'user_feed': 'playlists', 'login': 'true', 'folder': 'true'})
assert(sys.modules["__main__"].feeds.listAll.call_count == 1)
示例3: test_addToPlaylist_should_call_core_add_to_playlist_if_user_has_selected_playlist
# 需要导入模块: from YouTubePlaylistControl import YouTubePlaylistControl [as 别名]
# 或者: from YouTubePlaylistControl.YouTubePlaylistControl import addToPlaylist [as 别名]
def test_addToPlaylist_should_call_core_add_to_playlist_if_user_has_selected_playlist(self):
sys.modules["__main__"].xbmcgui.Dialog().select.return_value = 1
sys.modules["__main__"].feeds.listAll.return_value = ([{"Title":"PlayList1","playlist":"playlist1"},{"Title":"PlayList2","playlist":"playlist2"}])
control = YouTubePlaylistControl()
control.createPlayList = Mock()
control.addToPlaylist({})
sys.modules["__main__"].core.add_to_playlist.assert_called_with({'user_feed': 'playlists', 'login': 'true', 'playlist': 'playlist1', 'folder': 'true'})
示例4: test_addToPlaylist_should_ask_user_for_playlist_if_playlist_is_not_in_params
# 需要导入模块: from YouTubePlaylistControl import YouTubePlaylistControl [as 别名]
# 或者: from YouTubePlaylistControl.YouTubePlaylistControl import addToPlaylist [as 别名]
def test_addToPlaylist_should_ask_user_for_playlist_if_playlist_is_not_in_params(self):
sys.modules["__main__"].feeds.listAll.return_value = ([{"Title":"PlayList1"},{"Title":"PlayList2"}])
sys.modules["__main__"].xbmcgui.Dialog().select.return_value = 0
control = YouTubePlaylistControl()
control.createPlayList = Mock()
control.addToPlaylist({})
assert(sys.modules["__main__"].xbmcgui.Dialog.call_count == 2)
assert(sys.modules["__main__"].xbmcgui.Dialog().select.call_count == 1)