Implement subscription from RSS feed
This commit is contained in:
parent
4674cc926c
commit
835b9a42a1
11 changed files with 185 additions and 271 deletions
19
tests/test_youtube_manager.py
Normal file
19
tests/test_youtube_manager.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue