def show(vidid): g.menu['select_top_menu']['home'] = True user = users.current() render_data = {} if vidid == 'random': render_data['mode'] = 'normal' video = videos.random() watchtran.begin(user, video) else: render_data['mode'] = 'specific' video = videos.find(vidid) # TODO: remove line below watchtran.begin(user, video) if video is None: abort(404) render_data['video'] = video render_data['user_message_size'] = USER_MESSAGE_SIZE scomments = comments.for_screening(video, user) render_data['comments'] = scomments return render_template('player/screening.html', **render_data)
def test_random(self): '''Test the random choice of video resource''' video = videos.random() self.assertIsNotNone(video)