Skip to content

Commit cf694e8

Browse files
committed
Add macOS tests
1 parent 51d53f0 commit cf694e8

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

test/test_vendor.py

+33-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
class LinuxVendorTests(unittest.TestCase):
2121

2222
def setUp(self):
23-
open('test/cdm/libwidevinecdm_vendor.so', 'w').write('Linux\n1.2.3.4')
23+
with open('test/cdm/libwidevinecdm_vendor.so', 'w') as fdesc:
24+
fdesc.write('Linux\n1.2.3.4')
2425

2526
def tearDown(self):
2627
os.unlink('test/cdm/libwidevinecdm_vendor.so')
@@ -48,7 +49,8 @@ def test_about():
4849
class WindowsVendorTests(unittest.TestCase):
4950

5051
def setUp(self):
51-
open('test/cdm/widevinecdm_vendor.dll', 'w').write('Windows\n1.2.3.4')
52+
with open('test/cdm/widevinecdm_vendor.dll', 'w') as fdesc:
53+
fdesc.write('Windows\n1.2.3.4')
5254

5355
def tearDown(self):
5456
os.unlink('test/cdm/widevinecdm_vendor.dll')
@@ -74,5 +76,34 @@ def test_about():
7476
default.run(['default.py', 'info'])
7577

7678

79+
class DarwinVendorTests(unittest.TestCase):
80+
81+
def setUp(self):
82+
with open('test/cdm/libwidevinecdm_vendor.dylib', 'w') as fdesc:
83+
fdesc.write('macOS\n1.2.3.4')
84+
85+
def tearDown(self):
86+
os.unlink('test/cdm/libwidevinecdm_vendor.dylib')
87+
88+
def test_check_inputstream_mpd(self):
89+
inputstreamhelper.system_os = lambda: 'Darwin'
90+
platform.machine = lambda: 'x86_64'
91+
is_helper = inputstreamhelper.Helper('mpd', drm='com.widevine.alpha')
92+
is_helper.remove_widevine()
93+
is_installed = is_helper.check_inputstream()
94+
self.assertTrue(is_installed, True)
95+
96+
def test_check_inputstream_hls_again(self):
97+
inputstreamhelper.system_os = lambda: 'Darwin'
98+
platform.machine = lambda: 'x86_64'
99+
is_helper = inputstreamhelper.Helper('hls', drm='com.widevine.alpha')
100+
is_installed = is_helper.check_inputstream()
101+
self.assertTrue(is_installed, True)
102+
103+
@staticmethod
104+
def test_about():
105+
default.run(['default.py', 'info'])
106+
107+
77108
if __name__ == '__main__':
78109
unittest.main()

0 commit comments

Comments
 (0)