-
Notifications
You must be signed in to change notification settings - Fork 7
/
tests.py
33 lines (24 loc) · 835 Bytes
/
tests.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
import os
from unittest import TestCase
from feeddiasp import Diasp, RSSParser
RSS_FEED_URL = "http://www.spiegel.de/schlagzeilen/tops/index.rss"
class DiaspClientTestCase(TestCase):
def setUp(self):
self.pod = os.environ['FEEDDIASP_TEST_POD']
self.username = os.environ['FEEDDIASP_TEST_USERNAME']
self.password = os.environ['FEEDDIASP_TEST_PASSWORD']
def test_login(self):
client = Diasp(
pod=self.pod,
username=self.username,
password=self.password)
try:
client.login()
except Exception as e:
self.fail(e)
class RSSParserTestCase(TestCase):
def test_get_posts(self):
rss = RSSParser(url=RSS_FEED_URL)
rss.update()
posts = rss.get_entries()
self.assertTrue(len(posts) > 0)