import logging from pathlib import Path from breadtube_bot.youtube_manager import YoutubeManager from breadtube_bot.youtube_subscription import ChannelInfo def test_rss_parsing(): logger = logging.getLogger('breadtube-bot-test') manager = YoutubeManager(logger=logger) channel_info, videos = manager._parse_rss_data(Path('tests/data/rss_feed_sample.xml').read_text(encoding='utf-8')) assert channel_info == ChannelInfo( channel_id='UCFemKOoYVrTGUhuVzuNPt4A', title='Actu Réfractaire', url='https://www.youtube.com/channel/UCFemKOoYVrTGUhuVzuNPt4A') assert len(videos) == 15 video_ids = {'RZfVeU_iK0I', 'sLTFoRQHq3o', 'BcJ-ATQOQps', 'bOF1Pbtdg7U', '8yai5Maa1Wc', 'j1wU7JSUhe0', 'agAf1SdyK_Y', 'a4Kj_vUULfI', 'Sl2ukhsD7w0', 'wGSpwg0MC98', 'JNWkTB-7Zyk', '2I9rY7zSLPs', 'yR98Ur1BUJ8', 'HHBZ75L_vvY', 'tmBt6RCr6gQ'} assert {video.video_id for video in videos} == video_ids