-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
54 lines (43 loc) · 1.45 KB
/
test.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
from src.config import CONFIG
from src.controller import send_latest_feeds
from src.RSSFeed import RSSFeed
from src.notifications import Notification
# TEST FUNCTIONS
def test_RSSFeed_1():
feed_url = "https://www.reddit.com/r/Python/new/.rss"
feed = RSSFeed(feed_url)
feed_items = feed.parse()
for item in feed_items:
print(f"{item['id']}: {item['title']} {item['link']}")
def test_RSSFeed_2():
feed_url = "https://lorem-rss.herokuapp.com/feed?unit=second&interval=30&length=2"
feed = RSSFeed(feed_url, "db/", history_limit=3)
feed_items = feed.get_latest()
for item in feed_items:
print(f"id={item['id']} title={item['title']} link={item['link']}")
def test_RSSFeed_3():
feed_url = "https://cloud.google.com/feeds/gke-main-release-notes.xml"
feed = RSSFeed(feed_url, "db/", history_limit=10)
feed_items = feed.parse()
for item in feed_items:
print(f"id={item['id']} title={item['title']} link={item['link']}")
def test_full_1():
for job in CONFIG["jobs"]:
send_latest_feeds(**job)
def test_http_request():
url = "https://hook.eu2.make.com/....."
item = {
"title": "This is an example task",
"body": "With an example body content"
}
receiver = {
"type": "http_request",
"url": url
}
Notification.http_request(item, receiver)
# RUN TESTS
# test_RSSFeed_1()
# test_RSSFeed_2()
# test_RSSFeed_3()
# test_full_1()
test_http_request()