本文整理汇总了Python中VimeoStorage.VimeoStorage类的典型用法代码示例。如果您正苦于以下问题:Python VimeoStorage类的具体用法?Python VimeoStorage怎么用?Python VimeoStorage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VimeoStorage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getStorageKey_should_call_getResultSetStorageKey_if_type_is_not_set
def test_getStorageKey_should_call_getResultSetStorageKey_if_type_is_not_set(self):
storage = VimeoStorage()
storage._getResultSetStorageKey = Mock()
result = storage.getStorageKey({"some_param": "param_value"})
storage._getResultSetStorageKey.assert_called_with({"some_param": "param_value"})
示例2: test_getStorageKey_should_call_getThumbnailStorageKey_if_type_is_thumbnail
def test_getStorageKey_should_call_getThumbnailStorageKey_if_type_is_thumbnail(self):
storage = VimeoStorage()
storage._getThumbnailStorageKey = Mock()
result = storage.getStorageKey({"some_param": "param_value"}, "thumbnail")
storage._getThumbnailStorageKey.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 = VimeoStorage()
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_storeSettings_should_call_getStorageKey_to_fetch_correct_storage_key
def test_storeSettings_should_call_getStorageKey_to_fetch_correct_storage_key(self):
storage = VimeoStorage()
storage.getStorageKey = Mock()
result = storage.storeSettings({"storeSettings": "pokeystoreSettings"})
storage.getStorageKey.assert_called_with({"storeSettings": "pokeystoreSettings"}, "", {})
示例5: test_retrieveResultSet_should_evaluate_content_from_sql_get
def test_retrieveResultSet_should_evaluate_content_from_sql_get(self):
storage = VimeoStorage()
sys.modules["__main__"].cache.get.return_value = "['some_value']"
result = storage.retrieveResultSet("some_key")
assert result == ["some_value"]
示例6: test_getStorageKey_should_call_getViewModeStorageKey_if_type_is_viewmode
def test_getStorageKey_should_call_getViewModeStorageKey_if_type_is_viewmode(self):
storage = VimeoStorage()
storage._getViewModeStorageKey = Mock()
result = storage.getStorageKey({"some_param": "param_value"}, "viewmode")
storage._getViewModeStorageKey.assert_called_with({"some_param": "param_value"}, {})
示例7: test_getStoredSearches_should_call_quote_plus_on_search_items
def test_getStoredSearches_should_call_quote_plus_on_search_items(self):
patcher = patch("urllib.quote_plus")
patcher.start()
import urllib
urllib.quote_plus.return_value = "some_quoted_search"
storage = VimeoStorage()
storage.retrieve = Mock()
storage.retrieve.return_value = ["some_search"]
storage.retrieveSettings = Mock()
storage.retrieveSettings.return_value = ["some_search"]
storage.storeSettings = Mock()
(result, status) = storage.getStoredSearches({"path": "some_path"})
args = urllib.quote_plus.call_args
patcher.stop()
print repr(result)
assert args[0][0] == "some_search"
assert result == [
{
"path": "some_path",
"search": "some_quoted_search",
"api": "search",
"icon": "search",
"thumbnail": ["some_search"],
"Title": "some_search",
}
]
示例8: test_getViewModeStorageKey_should_handle_external_marker
def test_getViewModeStorageKey_should_handle_external_marker(self):
storage = VimeoStorage()
result = storage._getViewModeStorageKey(
{"channel": "some_channel", "external": "true", "contact": "some_contact"}
)
assert result[: result.find("_")] == "external"
示例9: test_list_should_call_getUserOptionFolder_if_store_contact_option_is_in_params
def test_list_should_call_getUserOptionFolder_if_store_contact_option_is_in_params(self):
storage = VimeoStorage()
storage.getUserOptionFolder = Mock()
storage.getUserOptionFolder.return_value = ("", 200)
storage.list({"store": "contact_options"})
storage.getUserOptionFolder.assert_called_with({"store": "contact_options"})
示例10: test_getResultSetStorageKey_should_handle_external_correctly
def test_getResultSetStorageKey_should_handle_external_correctly(self):
storage = VimeoStorage()
result = storage._getResultSetStorageKey(
{"api": "my_playlists", "playlist": "some_playlist", "external": "true", "contact": "some_contact"}
)
assert result.find("external") > 0
示例11: test_getThumbnailStorageKey_should_return_correct_key_for_search_item
def test_getThumbnailStorageKey_should_return_correct_key_for_search_item(self):
storage = VimeoStorage()
result = storage._getThumbnailStorageKey(
{"some_param": "something"}, {"search": "some_search", "feed": "search"}
)
assert result == "search_some_search_thumb"
示例12: test_getValueStorageKey_should_handle_external_marker
def test_getValueStorageKey_should_handle_external_marker(self):
storage = VimeoStorage()
result = storage._getValueStorageKey(
{"user_feed": "playlist", "external": "true", "contact": "some_contact"}, {"playlist": "some_playlist"}
)
assert result == "reverse_playlist_some_playlist_external_some_contact"
示例13: test_getReversePlaylistOrder_should_call_retrieve_to_fetch_reverse_value
def test_getReversePlaylistOrder_should_call_retrieve_to_fetch_reverse_value(self):
storage = VimeoStorage()
storage.retrieve = Mock()
storage.retrieve.return_value = "true"
result = storage.getReversePlaylistOrder({"playlist": "some_playlists"})
assert result == True
示例14: test_storeResultSet_should_call_settings_getSetting_to_get_stored_searches_limit_if_prepend_is_params
def test_storeResultSet_should_call_settings_getSetting_to_get_stored_searches_limit_if_prepend_is_params(self):
sys.modules["__main__"].settings.getSetting.return_value = "0"
storage = VimeoStorage()
storage.retrieveResultSet = Mock()
storage.retrieveResultSet.return_value = []
storage.storeResultSet("some_key", ["some_value"], {"prepend": "true"})
sys.modules["__main__"].settings.getSetting.assert_called_with("saved_searches")
示例15: test_getStoredSearches_should_call_retrieve_to_get_searches
def test_getStoredSearches_should_call_retrieve_to_get_searches(self):
storage = VimeoStorage()
storage.retrieveSettings = Mock()
storage.retrieveSettings.return_value = ["some_search"]
storage.storeSettings = Mock()
storage.getStoredSearches({"path": "some_path"})
assert storage.retrieveSettings.call_count > 0