File: test_dc.py

package info (click to toggle)
python-feedgen 1.0.0-9
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 508 kB
  • sloc: python: 4,412; makefile: 175; javascript: 26
file content (31 lines) | stat: -rw-r--r-- 867 bytes parent folder | download | duplicates (2)
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
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)
                self.assertEqual(m(), [method])

        self.fg.id('123')
        self.assertTrue(self.fg.atom_str())
        self.assertTrue(self.fg.rss_str())