File: test_ustreamtv.py

package info (click to toggle)
streamlink 8.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,564 kB
  • sloc: python: 51,188; sh: 184; makefile: 152
file content (73 lines) | stat: -rw-r--r-- 2,075 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from __future__ import annotations

from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock

from streamlink.plugins.ustreamtv import UStreamTV
from tests.plugins import PluginCanHandleUrl


if TYPE_CHECKING:
    from streamlink import Streamlink


class TestPluginCanHandleUrlUStreamTV(PluginCanHandleUrl):
    __plugin__ = UStreamTV

    should_match_groups = [
        (
            "https://www.ustream.tv/nasahdtv",
            {},
        ),
        (
            "https://www.ustream.tv/channel/6540154",
            {"channel_id": "6540154"},
        ),
        (
            "https://www.ustream.tv/channel/id/6540154",
            {"channel_id": "6540154"},
        ),
        (
            "https://www.ustream.tv/embed/6540154",
            {"channel_id": "6540154"},
        ),
        (
            "https://www.ustream.tv/recorded/132041157",
            {"video_id": "132041157"},
        ),
        (
            "https://www.ustream.tv/embed/recorded/132041157",
            {"video_id": "132041157"},
        ),
        (
            "https://www.ustream.tv/combined-embed/6540154",
            {"combined_channel_id": "6540154"},
        ),
        (
            "https://www.ustream.tv/combined-embed/6540154/video/132041157",
            {"combined_channel_id": "6540154", "combined_video_id": "132041157"},
        ),
        (
            "https://video.ibm.com/nasahdtv",
            {},
        ),
        (
            "https://video.ibm.com/recorded/132041157",
            {"video_id": "132041157"},
        ),
    ]


class TestPluginUStreamTV:
    def test_arguments(self, session: Streamlink):
        from streamlink_cli.main import setup_plugin_args  # noqa: PLC0415

        parser = MagicMock()
        plugins = parser.add_argument_group("Plugin Options")
        group = parser.add_argument_group("UStreamTV", parent=plugins)

        session.plugins["ustreamtv"] = UStreamTV

        setup_plugin_args(session, parser)

        group.add_argument.assert_called_with("--ustream-password", metavar="PASSWORD", help=ANY)