def test_podcast_lookup_by_byitunesid(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) results = index.podcastByItunesId(itunesId) assert results["feed"][ "title"] == podcastTitle, "Did not find the right podcast when doing lookup by Itunes ID"
def test_trending_podcasts_lang(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) results = index.trendingPodcasts(lang=["es"]) for feed in results["feeds"]: assert feed["language"] == "es"
def test_podcast_lookup_by_feedurl(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) results = index.podcastByFeedUrl(feedUrl) assert results["feed"][ "title"] == podcastTitle, "Did not find the right podcast when doing lookup by URL"
def test_trending_podcasts_max(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) results = index.trendingPodcasts(max=15) assert len( results["feeds"]) == 15, "By default we expect to get back 10 results"
def test_trending_podcasts_since(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) results = index.trendingPodcasts(since=-(24 * 3600)) for feed in results["feeds"]: last_updated = feed["newestItemPublishTime"] assert time.time() - last_updated < 24 * 3600
def test_search_clean(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) query_str = "Sex" results_dirty = index.search(query_str, clean=False) results_clean = index.search(query_str, clean=True) assert len(results_clean["feeds"]) < len(results_dirty["feeds"])
def test_trending_podcasts_not_categories(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) categories = ["News", "Comedy"] results = index.trendingPodcasts(not_categories=categories) for feed in results["feeds"]: for id in feed["categories"]: assert not feed["categories"][id] in categories
def test_trending_podcasts_categories(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) categories = ["News", "Comedy"] results = index.trendingPodcasts(categories=categories) for feed in results["feeds"]: assert categories[0] in feed["categories"].values( ) or categories[1] in feed["categories"].values()
def test_search_found(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) query_str = "This American Life" results = index.search(query_str) found = False for feed in results["feeds"]: title = feed["title"] if query_str == title: # Found a matching feed found = True break assert found, "Count not find podcast that should be in the feed: {}".format(query_str)
def test_recent_episodes_max(): config = podcastindex.get_config_from_env() index = podcastindex.init(config) results = index.recentEpisodes(max=15) assert len(results["items"]) == 15, "By default we expect to get back 10 results"