Exemplo n.º 1
0
    def test_list_should_call_vimeo_client_correctly_if_api_is_my_contacts_in_params(self):
        sys.modules["__main__"].settings.getSetting.side_effect = ["1","1","1","user_id", "1"]
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"api":"my_contacts"})

        sys.modules["__main__"].client.vimeo_contacts_getAll.assert_any_call(user_id="user_id", page=1, per_page=15, full_response="true")
Exemplo n.º 2
0
    def test_list_should_call_vimeo_client_correctly_if_api_is_search_in_params(self):
        sys.modules["__main__"].settings.getSetting.side_effect = ["1","1","1","user_id", "1"]
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"api":"search", "search":"some_query"})

        sys.modules["__main__"].client.vimeo_videos_search.assert_any_call(query="some_query", page=1, per_page=15, full_response="true")
Exemplo n.º 3
0
    def test_list_should_call_vimeo_client_correctly_if_group_is_in_params(self):
        sys.modules["__main__"].settings.getSetting.return_value = "1"
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"group":"some_group"})

        sys.modules["__main__"].client.vimeo_groups_getVideos.assert_any_call(group_id="some_group", page=1, per_page=15, full_response="true")
Exemplo n.º 4
0
    def test_list_should_call_getVideoInfo_if_folder_is_not_in_params(self):
        sys.modules["__main__"].settings.getSetting.side_effect = ["1","1","1","user_id", "1"]
        sys.modules["__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"api":"my_contacts"})

        core._getvideoinfo.assert_any_call("222", {"api":"my_contacts"})
Exemplo n.º 5
0
    def test_list_should_call_vimeo_client_correctly_if_group_is_in_params(
            self):
        sys.modules["__main__"].settings.getSetting.return_value = "1"
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"group": "some_group"})

        sys.modules["__main__"].client.vimeo_groups_getVideos.assert_any_call(
            group_id="some_group", page=1, per_page=15, full_response="true")
Exemplo n.º 6
0
    def test_list_should_call_getVideoInfo_if_folder_is_not_in_params(self):
        sys.modules["__main__"].settings.getSetting.side_effect = [
            "1", "1", "1", "user_id", "1"
        ]
        sys.modules[
            "__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"api": "my_contacts"})

        core._getvideoinfo.assert_any_call("222", {"api": "my_contacts"})
Exemplo n.º 7
0
    def test_list_should_call_vimeo_client_correctly_if_api_is_my_contacts_in_params(
            self):
        sys.modules["__main__"].settings.getSetting.side_effect = [
            "1", "1", "1", "user_id", "1"
        ]
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"api": "my_contacts"})

        sys.modules["__main__"].client.vimeo_contacts_getAll.assert_any_call(
            user_id="user_id", page=1, per_page=15, full_response="true")
Exemplo n.º 8
0
    def test_list_should_call_vimeo_client_correctly_if_api_is_search_in_params(
            self):
        sys.modules["__main__"].settings.getSetting.side_effect = [
            "1", "1", "1", "user_id", "1"
        ]
        core = VimeoCore()
        core._getvideoinfo = Mock()

        core.list({"api": "search", "search": "some_query"})

        sys.modules["__main__"].client.vimeo_videos_search.assert_any_call(
            query="some_query", page=1, per_page=15, full_response="true")
Exemplo n.º 9
0
    def test_getvideoinfo_should_call_getThumbnail_on_album_lists(self):
        sys.modules["__main__"].settings.getSetting.return_value = "2"
        sys.modules["__main__"].common.parseDOM.side_effect = [["some_value"],["some_value"],["some_value"],["some_value"],["some_value"],["some_value"],["3"]]
        sys.modules["__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core.checkIfMorePagesExist = Mock(return_value=True)
        core.getThumbnail = Mock(return_value="some_value")

        result = core._getvideoinfo("some_html_string", {})

        print repr(result)
        core.getThumbnail.assert_any_call("some_value","default")
Exemplo n.º 10
0
    def test_getvideoinfo_should_add_thumbnail_to_channel_list(self):
        sys.modules["__main__"].settings.getSetting.return_value = "2"
        sys.modules["__main__"].common.parseDOM.side_effect = [["some_value"],["some_value"],["some_value"],["some_value"],["some_value"],["some_value"],["3"]]
        sys.modules["__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core.checkIfMorePagesExist = Mock()
        core.getThumbnail = Mock(return_value="some_value")

        result = core._getvideoinfo("some_html_string", {})

        print repr(result)
        assert (result[0].has_key("thumbnail"))
Exemplo n.º 11
0
    def test_getvideoinfo_should_construct_proper_item_list(self):
        sys.modules["__main__"].settings.getSetting.return_value = "2"
        sys.modules["__main__"].common.parseDOM.side_effect = [["some_value"],["some_value"],["some_value"],["some_value"],["some_value"],["some_value"],["3"]]
        sys.modules["__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core.checkIfMorePagesExist = Mock(return_value=True)
        core.getThumbnail = Mock(return_value="some_value")

        result = core._getvideoinfo("some_html_string", {})

        print repr(result)
        assert (result[0].has_key("videoid"))
        assert (result[0].has_key("Overlay"))
        assert (result[0].has_key("contact"))
        assert (result[0].has_key("Studio"))
        assert (result[0].has_key("Duration"))
        assert (result[0].has_key("Title"))
Exemplo n.º 12
0
    def test_getvideoinfo_should_call_getThumbnail_on_album_lists(self):
        sys.modules["__main__"].settings.getSetting.return_value = "2"
        sys.modules["__main__"].common.parseDOM.side_effect = [["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["3"]]
        sys.modules[
            "__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core.checkIfMorePagesExist = Mock(return_value=True)
        core.getThumbnail = Mock(return_value="some_value")

        result = core._getvideoinfo("some_html_string", {})

        print repr(result)
        core.getThumbnail.assert_any_call("some_value", "default")
Exemplo n.º 13
0
    def test_getvideoinfo_should_add_thumbnail_to_channel_list(self):
        sys.modules["__main__"].settings.getSetting.return_value = "2"
        sys.modules["__main__"].common.parseDOM.side_effect = [["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["3"]]
        sys.modules[
            "__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core.checkIfMorePagesExist = Mock()
        core.getThumbnail = Mock(return_value="some_value")

        result = core._getvideoinfo("some_html_string", {})

        print repr(result)
        assert (result[0].has_key("thumbnail"))
Exemplo n.º 14
0
    def test_getvideoinfo_should_construct_proper_item_list(self):
        sys.modules["__main__"].settings.getSetting.return_value = "2"
        sys.modules["__main__"].common.parseDOM.side_effect = [["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["some_value"],
                                                               ["3"]]
        sys.modules[
            "__main__"].client.vimeo_contacts_getAll.return_value = "222"
        core = VimeoCore()
        core.checkIfMorePagesExist = Mock(return_value=True)
        core.getThumbnail = Mock(return_value="some_value")

        result = core._getvideoinfo("some_html_string", {})

        print repr(result)
        assert (result[0].has_key("videoid"))
        assert (result[0].has_key("Overlay"))
        assert (result[0].has_key("contact"))
        assert (result[0].has_key("Studio"))
        assert (result[0].has_key("Duration"))
        assert (result[0].has_key("Title"))