예제 #1
0
def test_player_stop():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.stop()
    assert myplayer._player.stop.call_count == 1
    assert myplayer.state == 0
예제 #2
0
def test_player_time_str():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()
    myplayer._media = mock.MagicMock()

    myplayer._player.get_time = mock.MagicMock(return_value=3000)
    myplayer._media.get_duration = mock.MagicMock(return_value=6000)
    assert myplayer.time_str == "00:00:03/00:00:06"
예제 #3
0
def test_player_vlc_play_from():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()
    myplayer.play_from(10)

    assert myplayer._player.play.call_count == 1
    assert myplayer.state == 1
    myplayer._player.set_time.assert_called_with(10 * 1000)
예제 #4
0
def test_player_vlc_change_rate_display():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()
    myplayer._player.get_rate = mock.MagicMock(return_value=1)
    display = mock.MagicMock()

    myplayer.change_rate(1, display=display)
    assert display.change_status.call_count == 1
예제 #5
0
def test_player_time():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer._player.get_time = mock.MagicMock(return_value=5000)
    assert myplayer.time == 5000
예제 #6
0
def test_player_episode():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert myplayer.episode == episode
예제 #7
0
def test_player_str():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert str(myplayer) == myplayer.title
예제 #8
0
def test_player_del():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert "myplayer" in locals()
    del myplayer
    assert "myplayer" not in locals()
예제 #9
0
def test_player_init():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert isinstance(myplayer, VLCPlayer)
예제 #10
0
def test_player_vlc_title():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert myplayer.title == "player1 title"
예제 #11
0
def test_player_vlc_str():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    assert str(myplayer) == "[%s] %s" % (episode.feed_str, myplayer.title)
예제 #12
0
def test_player_vlc_change_rate_increase():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.set_rate(1.6)
    assert myplayer._player.set_rate.call_count == 1
예제 #13
0
def test_player_vlc_seek():
    myplayer = VLCPlayer("player1 title", "player1 path", episode)
    myplayer._player = mock.MagicMock()

    myplayer.seek(1, 10)
    myplayer._player.set_time.assert_called_with(myplayer._player.get_time() + 10 * 1000)