本文整理汇总了Python中YouTubeStorage.YouTubeStorage类的典型用法代码示例。如果您正苦于以下问题:Python YouTubeStorage类的具体用法?Python YouTubeStorage怎么用?Python YouTubeStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了YouTubeStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getStorageKey_should_call_getThumbnailStorageKey_if_type_is_thumbnail
def test_getStorageKey_should_call_getThumbnailStorageKey_if_type_is_thumbnail(self):
storage = YouTubeStorage()
storage._getThumbnailStorageKey = Mock()
result = storage.getStorageKey({"some_param": "param_value"}, "thumbnail")
storage._getThumbnailStorageKey.assert_called_with({"some_param": "param_value"}, {})
示例2: test_getStorageKey_should_call_getResultSetStorageKey_if_type_is_not_set
def test_getStorageKey_should_call_getResultSetStorageKey_if_type_is_not_set(self):
storage = YouTubeStorage()
storage._getResultSetStorageKey = Mock()
result = storage.getStorageKey({"some_param": "param_value"})
storage._getResultSetStorageKey.assert_called_with({"some_param": "param_value"})
示例3: test_saveStoredSearch_should_limit_search_collection_before_calling_store
def test_saveStoredSearch_should_limit_search_collection_before_calling_store(self):
sys.modules["__main__"].settings.getSetting.return_value = "0"
storage = YouTubeStorage()
storage.retrieveSettings = Mock()
storage.retrieveSettings.return_value = [
"some_search4",
"some_search2",
"some_search3",
"",
"",
"",
"",
"",
"",
"",
"",
]
storage.storeSettings = Mock()
storage.saveStoredSearch({"search": "some_search1", "old_search": "some_search2"})
assert len(storage.storeSettings.call_args[0][1]) == 10
storage.storeSettings.assert_called_with(
{"search": "some_search1", "old_search": "some_search2"},
["some_search1", "some_search4", "some_search3", "", "", "", "", "", "", ""],
)
示例4: test_getStorageKey_should_call_getViewModeStorageKey_if_type_is_viewmode
def test_getStorageKey_should_call_getViewModeStorageKey_if_type_is_viewmode(self):
storage = YouTubeStorage()
storage._getViewModeStorageKey = Mock()
result = storage.getStorageKey({"some_param": "param_value"}, "viewmode")
storage._getViewModeStorageKey.assert_called_with({"some_param": "param_value"}, {})
示例5: test_store_should_call_getStorageKey_to_fetch_correct_storage_key
def test_store_should_call_getStorageKey_to_fetch_correct_storage_key(self):
storage = YouTubeStorage()
storage.getStorageKey = Mock()
result = storage.store({"store": "pokeystore"})
storage.getStorageKey.assert_called_with({"store": "pokeystore"}, "", {})
示例6: test_getVideoIdStatusFromCache_should_set_overlay_information_on_requested
def test_getVideoIdStatusFromCache_should_set_overlay_information_on_requested(self):
storage = YouTubeStorage()
sys.modules["__main__"].cache.getMulti.return_value = ["2"]
result = storage.getVideoIdStatusFromCache("some_id", [{"videoid": "vid1", "Overlay": "1"}])
assert result[0]["Overlay"] == "2"
示例7: test_retrieveResultSet_should_evaluate_content_from_sql_get
def test_retrieveResultSet_should_evaluate_content_from_sql_get(self):
storage = YouTubeStorage()
sys.modules["__main__"].cache.get.return_value = "['some_value']"
result = storage.retrieveResultSet("some_key")
assert result == ["some_value"]
示例8: test_getVideoIdStatusFromCache_should_not_request_information_for_items_without_a_videoid
def test_getVideoIdStatusFromCache_should_not_request_information_for_items_without_a_videoid(self):
storage = YouTubeStorage()
sys.modules["__main__"].cache.getMulti.return_value = ["2"]
storage.getVideoIdStatusFromCache("some_id", [{"videoid": "vid1"}, {"other_id": "stuff"}])
sys.modules["__main__"].cache.getMulti.assert_any_call("some_id", ["vid1"])
示例9: test_getVideoIdStatusFromCache_should_call_cache_GetMulti_to_request_information
def test_getVideoIdStatusFromCache_should_call_cache_GetMulti_to_request_information(self):
storage = YouTubeStorage()
sys.modules["__main__"].cache.getMulti.return_value = ["2"]
storage.getVideoIdStatusFromCache("some_id", [{"videoid": "vid1"}, {"other_id": "stuff"}])
assert sys.modules["__main__"].cache.getMulti.call_count == 1
示例10: test_getThumbnailStorageKey_should_return_correct_key_for_search_item
def test_getThumbnailStorageKey_should_return_correct_key_for_search_item(self):
storage = YouTubeStorage()
result = storage._getThumbnailStorageKey(
{"some_param": "something"}, {"search": "some_search", "feed": "search"}
)
assert result == "search_some_search_thumb"
示例11: test_getReversePlaylistOrder_should_call_retrieve_to_fetch_reverse_value
def test_getReversePlaylistOrder_should_call_retrieve_to_fetch_reverse_value(self):
storage = YouTubeStorage()
storage.retrieve = Mock()
storage.retrieve.return_value = "true"
result = storage.getReversePlaylistOrder({"playlist": "some_playlists"})
assert result == True
示例12: test_changeSubscriptionView_should_call_getStorageKey
def test_changeSubscriptionView_should_call_getStorageKey(self):
storage = YouTubeStorage()
storage.getStorageKey = Mock()
storage.storeValue = Mock()
storage.changeSubscriptionView({"view_mode": "my_view_mode"})
storage.getStorageKey.assert_called_with({"user_feed": "my_view_mode", "view_mode": "my_view_mode"}, "viewmode")
示例13: YouTubeStorage
def test_list_should_call_getStoredSearches_if_store_is_defined_in_params_but_not_artist_or_contact_option(self):
storage = YouTubeStorage()
storage.getStoredSearches = Mock()
storage.getStoredSearches.return_value = ("", 200)
storage.list({"store": "somestore"})
storage.getStoredSearches.assert_called_with({"store": "somestore"})
示例14: test_getValueStorageKey_should_handle_external_marker
def test_getValueStorageKey_should_handle_external_marker(self):
storage = YouTubeStorage()
result = storage._getValueStorageKey(
{"user_feed": "playlist", "external": "true", "contact": "some_contact"}, {"playlist": "some_playlist"}
)
assert result == "reverse_playlist_some_playlist_external_some_contact"
示例15: test_getViewModeStorageKey_should_handle_external_marker
def test_getViewModeStorageKey_should_handle_external_marker(self):
storage = YouTubeStorage()
result = storage._getViewModeStorageKey(
{"channel": "some_channel", "external": "true", "contact": "some_contact"}
)
assert result[: result.find("_")] == "external"