def list_actor_related_videos(date, actor, video): raise_date_error, raise_actor_error, raise_video_error = True, True, True db_date = check_date(date) raise_date_error = db_date is None if raise_date_error: status_code = 450 raise InvalidUsage(get_error_message(status_code), status_code=status_code) actor = actor.replace('_', ' ') result_actor = DBYouTube.get_info_actor(db_date, actor) raise_actor_error = result_actor is None if raise_actor_error: status_code = 460 raise InvalidUsage(get_error_message(status_code), status_code=status_code) result = DBYouTube.get_video_by_actor(db_date, result_actor['channel_id'], video) raise_video_error = result is None if raise_video_error: status_code = 470 raise InvalidUsage(get_error_message(status_code), status_code=status_code) return jsonify(result)
def test_get_video_by_actor_video_error(self): video = DBYouTube.get_video_by_actor('2018-06-14', 'channel_id_value', 'fake_id') self.assertEqual(video, None)