def _create_moviedaos(): yb_parser = YBParser(app.config['YOURBIT_MOVIES_URL']) feed = yb_parser.parse_feed() torrents_titles = yb_parser.get_torrents_titles(feed) movie_titles = yb_parser.get_movies_titles(torrents_titles) moviedaos = [MovieDAO(title) for title in movie_titles] return moviedaos
def test_ybparser_remove_titles_duplicates_returns_no_duplicates(): movies_titles = ['duplicate', 'duplicate'] movies_titles = YBParser._remove_titles_duplicates(movies_titles) assert len(movies_titles) == 1 assert movies_titles[0] == 'duplicate'
def parser(): yb_parser = YBParser(Config.YOURBIT_MOVIES_URL) return yb_parser
def test_ybparser_parse_feed_returns_empty_feed_for_not_responding_feedurl(): yb_parser = YBParser("http://shoud.not.responding.com.pl") feed = yb_parser.parse_feed() assert not feed['entries']
def test_ybparser_is_inited_correctly_for_config_feedurl(): yb_parser = YBParser(Config.YOURBIT_MOVIES_URL) assert yb_parser._feed_url == Config.YOURBIT_MOVIES_URL
def test_ybparser_init_raise_exception_for_empty_feedurl(): with pytest.raises(ValueError) as e: yb_parser = YBParser("") assert "Corrupted feed url" in str(e.value)