-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest_discover_feeds.py
54 lines (48 loc) · 1.59 KB
/
test_discover_feeds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import logging
import os
from discover_feeds import *
def test_update_podcasts_config():
configured = [
{
"id": "abels_taarn",
"title": "De 10 siste fra Abels Tårn",
"season": None,
"enabled": True,
},
{
"id": "berrum_beyer_snakker_om_greier",
"title": "De 10 siste fra Foo og Bar",
"season": None,
"enabled": False,
"ignore": True,
},
]
discovered = {
"hele_historien" : {
"seriesId": "hele_historien",
"title": "De 10 siste fra Hele Historien",
},
"abels_taarn" : {
"seriesId": "abels_taarn",
"title": "De 10 siste fra Abels Tårn",
},
"berrum_beyer_snakker_om_greier" : {
"seriesId": "berrum_beyer_snakker_om_greier",
"title": "De 10 siste fra Foo og Bar",
},
"dagsnytt_atten" : {
"seriesId": "dagsnytt_atten",
"title": "De 10 siste fra dagsnytt_atten",
}
}
updated, changes = update_podcasts_config(configured, discovered)
logging.debug(updated)
os.makedirs("tests/", exist_ok=True)
helpers.write_podcasts_changelog("tests/DISCOVERY.md", datetime.now(), changes)
added = False
for feed in updated:
if feed['id'] == "hele_historien":
added = True # Ensure discovered feed has been added
if feed['id'] == "berrum_beyer_snakker_om_greier":
assert feed['enabled'] == False # Ensure ignore flag is respected
assert added == True