File: test_ustvnow.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 (42 lines) | stat: -rw-r--r-- 1,364 bytes parent folder | download | duplicates (4)
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
from streamlink.plugins.ustvnow import USTVNow
from tests.plugins import PluginCanHandleUrl


class TestPluginCanHandleUrlUSTVNow(PluginCanHandleUrl):
    __plugin__ = USTVNow

    should_match = [
        "https://www.ustvnow.com/channel/live/cbs",
    ]


class TestPluginUSTVNow:
    def test_encrypt_data(self):
        key = "80035ad42d7d-bb08-7a14-f726-78403b29"
        iv = "3157b5680927cc4a"

        assert (
            USTVNow.encrypt_data(
                b'{"login_id":"test@test.com","login_key":"testtest1234","login_mode":"1","manufacturer":"123"}',
                key,
                iv,
            )
            == (
                b"uawIc5n+TnmsmR+aP2iEDKG/eMKji6EKzjI4mE+zMhlyCbHm7K4hz7IDJDWwM3aE+Ro4ydSsgJf4ZInnoW6gqvXvG0qB"
                + b"/J2WJeypTSt4W124zkJpvfoJJmGAvBg2t0HT"
            )
        )  # fmt: skip

    def test_decrypt_data(self):
        key = "80035ad42d7d-bb08-7a14-f726-78403b29"
        iv = "3157b5680927cc4a"

        assert (
            USTVNow.decrypt_data(
                b"KcRLETVAmHlosM0OyUd5hdTQ6WhBRTe/YRAHiLJWrzf94OLkSueXTtQ9QZ1fjOLCbpX2qteEPUWVnzvvSgVDkQmRUttN"
                + b"/royoxW2aL0gYQSoH1NWoDV8sIgvS5vDiQ85",
                key,
                iv,
            )
            == b'{"status":false,"error":{"code":-2,"type":"","message":"Invalid credentials.","details":{}}}'
        )