def get_favs(self, username, session): favs = session.query(TVDBUserFavorite).filter( TVDBUserFavorite.username == username).first() if not favs: favs = TVDBUserFavorite(username=username) session.add(favs) return favs
def test_delete(self, mocked_expired, execute_task): persist['auth_tokens'] = {'default': None} with Session() as session: user_favs = TVDBUserFavorite(username='******') user_favs.series_ids = ['80379'] session.add(user_favs) task = execute_task('delete') task = task.find_entry(title='The.Big.Bang.Theory.S02E02.XVID-Flexget') assert task assert task.accepted with Session() as session: user_favs = session.query(TVDBUserFavorite).filter(TVDBUserFavorite.username == 'flexget').first() assert user_favs assert 80379 not in user_favs.series_ids
def test_delete(self, mocked_expired, execute_task): persist['auth_tokens'] = {'default': None} with Session() as session: user_favs = TVDBUserFavorite(username='******') user_favs.series_ids = ['80379'] session.add(user_favs) task = execute_task('delete') task = task.find_entry(title='The.Big.Bang.Theory.S02E02.XVID-Flexget') assert task assert task.accepted with Session() as session: user_favs = session.query(TVDBUserFavorite).filter( TVDBUserFavorite.username == 'flexget').first() assert user_favs assert 80379 not in user_favs.series_ids