import sys
from pathlib import Path
import yaml
sys.path.insert(0, str(Path(__file__).parent))
from intake.rss_intake import RSS_FEEDS
def test_unintegrated_references_are_not_productive_rss_sources():
names = {x['name'] for x in RSS_FEEDS}
urls = {x['url'] for x in RSS_FEEDS}
assert not any('Umweltbundesamt' in n or 'ASHRAE' in n or 'Passive House' in n for n in names)
assert not any('umweltbundesamt' in u or 'ashrae' in u or 'passiv.de' in u for u in urls)
def test_disabled_bbs_entity_is_not_active():
data = yaml.safe_load(Path('watch_entities.yaml').read_text())
entity = next(x for x in data['watch_entities'] if x['entity_id'] == 'bbs_management_mallorca')
assert entity['active'] is False
def test_active_verified_watch_entities_have_a_primary_ingestion_path():
data = yaml.safe_load(Path('watch_entities.yaml').read_text())
active = [x for x in data['watch_entities'] if x.get('active') and x.get('verification', {}).get('status') == 'verified']
assert active
assert all(x.get('blog_url') or x.get('youtube_channel_id') or x.get('facebook_url') or x.get('website') for x in active)