test_scrapers.py 1.4 KB

12345678910111213141516171819202122232425262728
  1. from vrobbler.apps.podcasts.scrapers import scrape_data_from_google_podcasts
  2. expected_desc = (
  3. "NPR's Up First is the news you need to start your day. "
  4. "The three biggest stories of the day, with reporting and analysis "
  5. "from NPR News — in 10 minutes. Available weekdays by 6 a.m. ET, "
  6. "with hosts Leila Fadel, Steve Inskeep, Rachel Martin and A Martinez. "
  7. "Also available on Saturdays by 8 a.m. ET, with Ayesha Rascoe and "
  8. "Scott Simon. On Sundays, hear a longer exploration behind the "
  9. "headlines with Rachel Martin, available by 8 a.m. ET. Subscribe "
  10. "and listen, then support your local NPR station at donate.npr.org. "
  11. "Support NPR's reporting by subscribing to Up First+ and unlock "
  12. "sponsor-free listening. Learn more at plus.npr.org/UpFirst"
  13. )
  14. expected_img_url = "https://encrypted-tbn2.gstatic.com/images?q=tbn:ANd9GcT-PqtK-bauo8wm8dBE__SVGArlvfBYY8rqxr2kA5UwjKzEx8c"
  15. expected_google_url = "https://podcasts.google.com/feed/aHR0cHM6Ly9mZWVkcy5ucHIub3JnLzUxMDMxOC9wb2RjYXN0LnhtbA"
  16. def test_get_not_allowed_from_mopidy():
  17. query = "Up First"
  18. result_dict = scrape_data_from_google_podcasts(query)
  19. assert result_dict["title"] == query
  20. assert result_dict["description"] == expected_desc
  21. assert result_dict["image_url"] == expected_img_url
  22. assert result_dict["producer"] == "NPR"
  23. assert result_dict["google_url"] == expected_google_url