def test_player_stop(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer.stop() myplayer._player.shutdown.assert_called_once() assert myplayer.state == 0
def test_player_time_str(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer._media = mock.MagicMock() myplayer._player.get_property = mock.MagicMock(return_value=5) assert myplayer.time_str == "00:00:05/00:00:05"
def test_player_mpv_time_str(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer._media = mock.MagicMock() myplayer._player.time_pos = 2 assert myplayer.time_str == "00:00:02/00:00:01"
def test_player_mpv_change_rate_decrease(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer._player.speed = 1 myplayer.change_rate(-1) assert myplayer._player.speed == 0.9
def test_player_pause(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer.pause() myplayer._player.set_property.assert_called_with('pause', True) assert myplayer.state == 2
def test_player_mpv_change_rate_display(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() display = mock.MagicMock() myplayer._player.speed = 1 myplayer.change_rate(1, display=display) assert display.change_status.call_count == 1
def test_player_mpv_str(): myplayer = MPVPlayer("player1 title", "player1 path", episode) assert str(myplayer) == "[%s] %s" % (episode.feed_str, myplayer.title)
def test_player_mpv_change_rate_increase(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer.set_rate(1.6) assert myplayer._player.speed == 1.6
def test_player_mpv_play_from(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer.play_from(10) assert myplayer._player.start == "00:00:10"
def test_player_mpv_seek(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer.seek(1, 10) myplayer._player.seek.assert_called_with(10)
def test_player_mpv_del(): myplayer = MPVPlayer("player1 title", "player1 path", episode) assert "myplayer" in locals() del myplayer assert "myplayer" not in locals()
def test_player_mpv_stop(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer.stop() assert myplayer.state == 0
def test_player_title(): myplayer = MPVPlayer("player1 title", "player1 path", episode) assert myplayer.title == "player1 title"
def test_player_str(): myplayer = MPVPlayer("player1 title", "player1 path", episode) assert str(myplayer) == myplayer.title
def test_player_time(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer._player.get_property = mock.MagicMock(return_value=5) assert myplayer.time == 5000
def test_player_mpv_episode(): myplayer = MPVPlayer("player1 title", "player1 path", episode) assert myplayer.episode == episode
def test_player_mpv_time(): myplayer = MPVPlayer("player1 title", "player1 path", episode) myplayer._player = mock.MagicMock() myplayer._player.time_pos = 5 assert myplayer.time == 5000
def test_player_mpv_init(): myplayer = MPVPlayer("player1 title", "player1 path", episode) assert isinstance(myplayer, MPVPlayer)