當前位置: 首頁>>代碼示例>>Python>>正文


Python YouTubeFeeds.YouTubeFeeds類代碼示例

本文整理匯總了Python中YouTubeFeeds.YouTubeFeeds的典型用法代碼示例。如果您正苦於以下問題:Python YouTubeFeeds類的具體用法?Python YouTubeFeeds怎麽用?Python YouTubeFeeds使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了YouTubeFeeds類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_createUrl_should_call_getSetting_to_get_videos_pr_page

 def test_createUrl_should_call_getSetting_to_get_videos_pr_page(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].pluginsettings.currentRegion.return_value = ""
     feeds = YouTubeFeeds()
     
     feeds.createUrl()
     
     sys.modules["__main__"].pluginsettings.itemsPerPage.assert_any_call()
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:8,代碼來源:TestYouTubeFeeds.py

示例2: test_createUrl_should_add_time_if_url_contains_time_param

 def test_createUrl_should_add_time_if_url_contains_time_param(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].pluginsettings.currentRegion.return_value = ""
     feeds = YouTubeFeeds()
     
     result = feeds.createUrl({"feed": "feed_linked"})
     
     assert(result.find("?time=this_week") > 0)
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:8,代碼來源:TestYouTubeFeeds.py

示例3: test_createUrl_should_get_correct_user_feed_url_if_user_feed_is_in_params

 def test_createUrl_should_get_correct_user_feed_url_if_user_feed_is_in_params(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].pluginsettings.currentRegion.return_value = ""
     feeds = YouTubeFeeds()
     
     result = feeds.createUrl({"user_feed": "favorites"})
     result = result[:result.find("?")]
     url = feeds.urls["favorites"] % ("default")
     assert(result == url)
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:9,代碼來源:TestYouTubeFeeds.py

示例4: test_createUrl_should_add_region_if_standard_feed

 def test_createUrl_should_add_region_if_standard_feed(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].pluginsettings.currentRegion.return_value = "AU"
     feeds = YouTubeFeeds()
     
     result = feeds.createUrl({"feed": "feed_linked"})
     
     result = result[:result.find("?")]
     assert(result.find("standardfeeds/AU/") > 0)
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:9,代碼來源:TestYouTubeFeeds.py

示例5: test_list_should_call_listPlaylist_if_playlist_is_in_params

    def test_list_should_call_listPlaylist_if_playlist_is_in_params(self):
        sys.modules["__main__"].settings.getSetting.return_value = "1"
        feeds = YouTubeFeeds()
        feeds.listPlaylist = Mock()
        
        result = feeds.list({"playlist": "some_playlist"})

        print repr(result)

        feeds.listPlaylist.assert_called_with({"playlist": "some_playlist"})
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:10,代碼來源:TestYouTubeFeeds.py

示例6: test_list_should_call_listFolder_if_folder_is_in_params

    def test_list_should_call_listFolder_if_folder_is_in_params(self):
        sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
        feeds = YouTubeFeeds()
        feeds.listFolder = Mock()
        
        result = feeds.list({"folder": "true"})

        print repr(result)

        feeds.listFolder.assert_called_with({"folder": "true"})
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:10,代碼來源:TestYouTubeFeeds.py

示例7: test_createUrl_should_add_playlist_to_url_if_playlist_is_in_params

 def test_createUrl_should_add_playlist_to_url_if_playlist_is_in_params(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].pluginsettings.currentRegion.return_value = ""
     feeds = YouTubeFeeds()
     
     result = feeds.createUrl({"feed": "playlist", "channel": "some_playlist"})
     
     result = result[:result.find("?")]
     url = feeds.urls["playlist"] % ("some_playlist")
     assert(result == url)
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:10,代碼來源:TestYouTubeFeeds.py

示例8: test_createUrl_should_start_index_and_max_results_for_non_folder_non_play_all_feeds

    def test_createUrl_should_start_index_and_max_results_for_non_folder_non_play_all_feeds(self):
        sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
        sys.modules["__main__"].pluginsettings.currentRegion.return_value = ""

        feeds = YouTubeFeeds()
        
        result = feeds.createUrl({"feed": "feed_linked"})
        
        result = result[result.find("?"):]
        assert(result == "?time=this_week&start-index=1&max-results=15")
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:10,代碼來源:TestYouTubeFeeds.py

示例9: test_listFolder_should_call_getSetting_to_get_perpage

 def test_listFolder_should_call_getSetting_to_get_perpage(self):
     feeds = YouTubeFeeds()
     feeds.listAll = Mock()
     feeds.listAll.return_value = []
     feeds.createUrl = Mock()
     feeds.createUrl.return_value = "some_url"
     
     feeds.listFolder()
     	
     sys.modules["__main__"].pluginsettings.itemsPerPage.assert_any_call()
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:10,代碼來源:TestYouTubeFeeds.py

示例10: test_createUrl_should_add_category_and_time_to_url_if_category_is_in_params

 def test_createUrl_should_add_category_and_time_to_url_if_category_is_in_params(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].pluginsettings.currentRegion.return_value = ""
     feeds = YouTubeFeeds()
     
     result = feeds.createUrl({"feed": "feed_category", "category": "some_category"})
     
     result = result[:result.rfind("&")]
     result = result[:result.rfind("&")]
     url = feeds.urls["feed_category"] % (("some_category"), "today")
     assert(result == url)
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:11,代碼來源:TestYouTubeFeeds.py

示例11: test_createUrl_should_get_correct_search_url_if_search_is_in_params

 def test_createUrl_should_get_correct_search_url_if_search_is_in_params(self):
     sys.modules["__main__"].settings.getSetting.return_value = "1"
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].pluginsettings.currentRegion.return_value = ""
     sys.modules["__main__"].pluginsettings.safeSearchLevel.return_value = "moderate"
     feeds = YouTubeFeeds()
     
     result = feeds.createUrl({"search": "some_search"})
     result = result[:result.find("moderate") + 8]
     url = feeds.urls["search"] % ("some_search", "moderate")
     assert(result == url)
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:11,代碼來源:TestYouTubeFeeds.py

示例12: test_listFolder_should_call_storage_store_to_save_new_list

 def test_listFolder_should_call_storage_store_to_save_new_list(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].storage.retrieve.return_value = []
     feeds = YouTubeFeeds()
     feeds.listAll = Mock()
     feeds.listAll.return_value = ["some"]
     feeds.createUrl = Mock()
     feeds.createUrl.return_value = "some_url"
     
     feeds.listFolder()
     	
     sys.modules["__main__"].storage.store.assert_called_with({}, ["some"])
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:12,代碼來源:TestYouTubeFeeds.py

示例13: test_listFolder_should_call_retrieve_to_get_view_mode_if_feed_is_subscriptions

 def test_listFolder_should_call_retrieve_to_get_view_mode_if_feed_is_subscriptions(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].storage.retrieve.return_value = [{"id": "some_item"}]
     feeds = YouTubeFeeds()
     feeds.listAll = Mock()
     feeds.listAll.return_value = [{"id": "some_item"}]
     feeds.createUrl = Mock()
     feeds.createUrl.return_value = "some_url"
     
     (videos, status) = feeds.listFolder({"user_feed": "subscriptions"})
     
     sys.modules["__main__"].storage.retrieve.assert_called_with({"user_feed": "subscriptions"}, "viewmode", {'user_feed': 'uploads', 'view_mode': 'subscriptions_favorites', 'id': 'some_item'})
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:12,代碼來源:TestYouTubeFeeds.py

示例14: test_listAll_should_call_fetchPage_correctly

 def test_listAll_should_call_fetchPage_correctly(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].storage.retrieve.return_value = "favorites"
     sys.modules["__main__"].core._fetchPage.return_value = {"content": "some_fail", "status": 200}
     sys.modules["__main__"].core.getVideoInfo.return_value = []
     feeds = YouTubeFeeds()
     feeds.createUrl = Mock()
     feeds.createUrl.return_value = "some_url"
     
     feeds.listAll({"login": "true"})
     
     sys.modules["__main__"].core._fetchPage.assert_called_with({"link": "some_urlv=2.1&start-index=1&max-results=50", "auth": "true"})
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:12,代碼來源:TestYouTubeFeeds.py

示例15: test_listFolder_should_set_correct_view_mode_if_feed_is_subscriptions

 def test_listFolder_should_set_correct_view_mode_if_feed_is_subscriptions(self):
     sys.modules["__main__"].pluginsettings.itemsPerPage.return_value = 15
     sys.modules["__main__"].storage.retrieve.return_value = "favorites"
     feeds = YouTubeFeeds()
     feeds.listAll = Mock()
     feeds.listAll.return_value = [{"id": "some_item"}]
     feeds.createUrl = Mock()
     feeds.createUrl.return_value = "some_url"
     
     (videos, status) = feeds.listFolder({"user_feed": "subscriptions"})
     
     assert(videos[0]["user_feed"] == "favorites")
開發者ID:1c0n,項目名稱:youtube-xbmc-plugin,代碼行數:12,代碼來源:TestYouTubeFeeds.py


注:本文中的YouTubeFeeds.YouTubeFeeds類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。