def test_playVideo_should_call_getVideoObject(self):
        player = VimeoPlayer()
        player.getVideoObject = Mock(return_value=[{"apierror": "some error"}, 303])

        player.playVideo()

        player.getVideoObject.assert_called_with({})
示例#2
0
    def ttest_playVideo_should_call_remove_from_watch_later_if_viewing_video_from_watch_later_queue(
            self):
        player = VimeoPlayer()
        sys.modules["__main__"].settings.getSetting.return_value = "0"
        sys.argv = ["test1", "1", "test2"]
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = ({
            "Title": "someTitle",
            "videoid": "some_id",
            "thumbnail": "someThumbnail",
            "video_url": "someUrl"
        }, 200)
        player.addSubtitles = Mock()
        call_params = {
            "videoid": "some_id",
            "watch_later": "true",
            "playlist": "playlist_id",
            "playlist_entry_id": "entry_id"
        }

        player.playVideo(call_params)

        sys.modules[
            "__main__"].core.remove_from_watch_later.assert_called_with(
                call_params)
示例#3
0
    def test_playVideo_should_call_getVideoObject(self):
        player = VimeoPlayer()
        player.getVideoObject = Mock(return_value=[{
            "apierror": "some error"
        }, 303])

        player.playVideo()

        player.getVideoObject.assert_called_with({})
    def test_playVideo_should_update_locally_stored_watched_status(self):
        sys.modules["__main__"].settings.getSetting.return_value = "0"
        sys.argv = ["test1", "1", "test2"]
        player = VimeoPlayer()
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = ({"Title": "someTitle", "videoid": "some_id", "thumbnail": "someThumbnail", "video_url": "someUrl"}, 200)
        player.addSubtitles = Mock()

        player.playVideo({"videoid": "some_id"})
        sys.modules["__main__"].storage.storeValue.assert_called_with("vidstatus-some_id", "7" )
    def test_playVideo_should_call_xbmc_setResolvedUrl(self):
        sys.modules["__main__"].settings.getSetting.return_value = "0"
        player = VimeoPlayer()
        player.addSubtitles = Mock()
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = ({"Title": "someTitle", "videoid": "some_id", "thumbnail": "someThumbnail", "video_url": "someUrl"}, 200)
        sys.argv = ["test1", "1", "test2"]

        player.playVideo({"videoid": "some_id"})

        assert(sys.modules["__main__"].xbmcplugin.setResolvedUrl.call_count > 0)
    def ttest_playVideo_should_call_remove_from_watch_later_if_viewing_video_from_watch_later_queue(self):
        player = VimeoPlayer()
        sys.modules["__main__"].settings.getSetting.return_value = "0"
        sys.argv = ["test1", "1", "test2"]
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = ({"Title": "someTitle", "videoid": "some_id", "thumbnail": "someThumbnail", "video_url": "someUrl"}, 200)
        player.addSubtitles = Mock()
        call_params = {"videoid": "some_id", "watch_later": "true", "playlist": "playlist_id", "playlist_entry_id": "entry_id"}

        player.playVideo(call_params)

        sys.modules["__main__"].core.remove_from_watch_later.assert_called_with(call_params)
示例#7
0
    def test_playVideo_should_update_locally_stored_watched_status(self):
        sys.modules["__main__"].settings.getSetting.return_value = "0"
        sys.argv = ["test1", "1", "test2"]
        player = VimeoPlayer()
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = ({
            "Title": "someTitle",
            "videoid": "some_id",
            "thumbnail": "someThumbnail",
            "video_url": "someUrl"
        }, 200)
        player.addSubtitles = Mock()

        player.playVideo({"videoid": "some_id"})
        sys.modules["__main__"].storage.storeValue.assert_called_with(
            "vidstatus-some_id", "7")
示例#8
0
    def test_playVideo_should_call_xbmc_setResolvedUrl(self):
        sys.modules["__main__"].settings.getSetting.return_value = "0"
        player = VimeoPlayer()
        player.addSubtitles = Mock()
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = ({
            "Title": "someTitle",
            "videoid": "some_id",
            "thumbnail": "someThumbnail",
            "video_url": "someUrl"
        }, 200)
        sys.argv = ["test1", "1", "test2"]

        player.playVideo({"videoid": "some_id"})

        assert (sys.modules["__main__"].xbmcplugin.setResolvedUrl.call_count >
                0)
    def test_playVideo_should_log_and_fail_gracefully_on_error(self):
        player = VimeoPlayer()
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = [{}, 303]

        result = player.playVideo()

        assert(result == False)
        assert(sys.modules["__main__" ].common.log.call_count > 0)
示例#10
0
    def test_playVideo_should_log_and_fail_gracefully_on_error(self):
        player = VimeoPlayer()
        player.getVideoObject = Mock()
        player.getVideoObject.return_value = [{}, 303]

        result = player.playVideo()

        assert (result == False)
        assert (sys.modules["__main__"].common.log.call_count > 0)