2019-07-08 05:49:56 +02:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from feedgen.feed import FeedGenerator
|
|
|
|
|
|
|
|
|
|
|
|
class TestExtensionDc(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
self.fg = FeedGenerator()
|
|
|
|
self.fg.load_extension('dc')
|
|
|
|
self.fg.title('title')
|
|
|
|
self.fg.link(href='http://example.com', rel='self')
|
|
|
|
self.fg.description('description')
|
|
|
|
|
|
|
|
def test_entryLoadExtension(self):
|
|
|
|
fe = self.fg.add_item()
|
|
|
|
try:
|
|
|
|
fe.load_extension('dc')
|
|
|
|
except ImportError:
|
|
|
|
pass # Extension already loaded
|
|
|
|
|
|
|
|
def test_elements(self):
|
|
|
|
for method in dir(self.fg.dc):
|
|
|
|
if method.startswith('dc_'):
|
|
|
|
m = getattr(self.fg.dc, method)
|
|
|
|
m(method)
|
2020-01-28 23:07:13 +01:00
|
|
|
self.assertEqual(m(), [method])
|
2019-07-08 05:49:56 +02:00
|
|
|
|
|
|
|
self.fg.id('123')
|
2020-01-28 23:07:13 +01:00
|
|
|
self.assertTrue(self.fg.atom_str())
|
|
|
|
self.assertTrue(self.fg.rss_str())
|