def test_bake_different_prefix(self): self.assertEqual(["test", "/H", "/foo", "bar", "/help"], StreamProcess.bake("test", dict(help=True, H=True, foo="bar"), long_option_prefix="/", short_option_prefix="/")) self.assertEqual(["test", "/?"], StreamProcess.bake("test", {"?": True}, long_option_prefix="/", short_option_prefix="/"))
def test_check_cmdline_long(self, which, mock_cmd): s = StreamProcess(Streamlink(), params=dict(out_file="test file.txt")) mock_cmd.return_value = "test" which.return_value = "test" self.assertEqual("test --out-file \"test file.txt\"", s.cmdline())
def test_check_cmdline(self, which, mock_cmd): s = StreamProcess(Streamlink(), params=dict(help=True)) mock_cmd.return_value = "test" which.return_value = "test" self.assertEqual("test --help", s.cmdline())
def test_check_cmd_nofound(self, which, mock_cmd): s = StreamProcess(Streamlink()) mock_cmd.return_value = "test" which.return_value = None self.assertRaises(StreamError, s._check_cmd)
def test_check_cmd_cat(self, which, mock_cmd): s = StreamProcess(Streamlink()) mock_cmd.return_value = "test" self.assertEqual("test", s._check_cmd())
def test_check_cmd_none(self, mock_cmd): s = StreamProcess(Streamlink()) mock_cmd.return_value = None self.assertRaises(StreamError, s._check_cmd)
def test_bake(parameters, arguments, expected): assert expected == StreamProcess.bake("test", parameters or {}, arguments or [])
def test_check_cmdline_long(self, which): s = StreamProcess(Streamlink(), params=dict(out_file="test file.txt")) which.return_value = s.cmd = "test" self.assertEqual("test --out-file \"test file.txt\"", s.cmdline())
def test_check_cmdline(self, which): s = StreamProcess(Streamlink(), params=dict(help=True)) which.return_value = s.cmd = "test" self.assertEqual("test --help", s.cmdline())
def test_check_cmd_nofound(self, which): s = StreamProcess(Streamlink()) s.cmd = "test" which.return_value = None self.assertRaises(StreamError, s._check_cmd)
def test_check_cmd_cat(self, which): s = StreamProcess(Streamlink()) which.return_value = s.cmd = "test" self.assertEqual("test", s._check_cmd())
def test_check_cmd_none(self): s = StreamProcess(Streamlink()) self.assertRaises(StreamError, s._check_cmd)