Example #1
0
    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)
Example #2
0
def radio_pause():
    pm.pause(current_user)