mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-29 20:45:11 +00:00
refactor(drm): build PlayReady from base64 with PlayReady.from_pssh_b64 in server keys and the wire rebuild
This commit is contained in:
@@ -13,7 +13,6 @@ import json
|
||||
from types import SimpleNamespace
|
||||
from uuid import UUID
|
||||
|
||||
import pyplayready.system.pssh as pr_pssh_mod
|
||||
import pytest
|
||||
from pyplayready.system.pssh import PSSH as RealPSSH
|
||||
|
||||
@@ -46,11 +45,6 @@ def _kidless_pro_b64() -> str:
|
||||
return base64.b64encode(pro).decode()
|
||||
|
||||
|
||||
class _FakePRPSSH:
|
||||
def __init__(self, data):
|
||||
self.data = data
|
||||
|
||||
|
||||
class _FakePlayReady:
|
||||
def __init__(self, pssh=None, pssh_b64=None, kid=None, **kwargs):
|
||||
self.kids = [kid] if kid else [KID_A]
|
||||
@@ -58,6 +52,10 @@ class _FakePlayReady:
|
||||
self.pssh_b64 = pssh_b64
|
||||
self.data = {"pssh_b64": pssh_b64} if pssh_b64 else {}
|
||||
|
||||
@classmethod
|
||||
def from_pssh_b64(cls, pssh_b64, kid=None):
|
||||
return cls(pssh_b64=pssh_b64, kid=kid)
|
||||
|
||||
@property
|
||||
def kid(self):
|
||||
return self.kids[0]
|
||||
@@ -97,7 +95,6 @@ def server_env(monkeypatch):
|
||||
|
||||
@pytest.fixture
|
||||
def fake_playready(monkeypatch):
|
||||
monkeypatch.setattr(pr_pssh_mod, "PSSH", _FakePRPSSH)
|
||||
monkeypatch.setattr(drm_mod, "PlayReady", _FakePlayReady)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user