示例#1
0
文件: test.py 项目: frach/homeberry
    def test_play_pause_resume_stop_anonymous_user(self):
        pm.play(self.anonymous_user, self.radio_to_play, dry_run=True)
        self.assertEqual(pm.status, pm.PLAYING)
        self.assertEqual(pm.started_by.username, self.anonymous_user.username)
        self.assertEqual(pm.paused_by, None)
        self.assertEqual(pm.playing_now.name, self.radio_to_play.name)

        pm.play(self.anonymous_user, self.radio_to_play, dry_run=True)
        self.assertEqual(pm.status, pm.PLAYING)
        self.assertEqual(pm.started_by.username, self.anonymous_user.username)
        self.assertEqual(pm.paused_by, None)
        self.assertEqual(pm.playing_now.name, self.radio_to_play.name)

        pm.pause(self.anonymous_user, dry_run=True)
        self.assertEqual(pm.status, pm.PAUSED)
        self.assertEqual(pm.started_by.username, self.anonymous_user.username)
        self.assertEqual(pm.paused_by.username, self.anonymous_user.username)
        self.assertEqual(pm.playing_now.name, self.radio_to_play.name)

        pm.pause(self.anonymous_user, dry_run=True)
        self.assertEqual(pm.status, pm.PAUSED)
        self.assertEqual(pm.started_by.username, self.anonymous_user.username)
        self.assertEqual(pm.paused_by.username, self.anonymous_user.username)
        self.assertEqual(pm.playing_now.name, self.radio_to_play.name)

        pm.resume(self.anonymous_user, dry_run=True)
        self.assertEqual(pm.status, pm.PLAYING)
        self.assertEqual(pm.started_by.username, self.anonymous_user.username)
        self.assertEqual(pm.paused_by, None)
        self.assertEqual(pm.playing_now.name, self.radio_to_play.name)

        pm.resume(self.anonymous_user, dry_run=True)
        self.assertEqual(pm.status, pm.PLAYING)
        self.assertEqual(pm.started_by.username, self.anonymous_user.username)
        self.assertEqual(pm.paused_by, None)
        self.assertEqual(pm.playing_now.name, self.radio_to_play.name)

        pm.stop(self.anonymous_user, dry_run=True)
        self.assertEqual(pm.status, pm.IDLE)
        self.assertEqual(pm.started_by, None)
        self.assertEqual(pm.paused_by, None)
        self.assertEqual(pm.playing_now, None)
示例#2
0
文件: views.py 项目: frach/homeberry
def radio_resume():
    pm.resume(current_user)