python-feedgen/tests/test_extensions/test_geo.py
Henry Walshaw d32487f2ed Separate extensions as their own files
Give each extension its own test file. Primarily this is done to make
it easier to add some fixtures and extend the geo tests.
2019-07-08 13:49:56 +10:00

29 lines
846 B
Python

import unittest
from lxml import etree
from feedgen.feed import FeedGenerator
class TestExtensionGeo(unittest.TestCase):
def setUp(self):
self.fg = FeedGenerator()
self.fg.load_extension('geo')
self.fg.title('title')
self.fg.link(href='http://example.com', rel='self')
self.fg.description('description')
def test_geoEntryItems(self):
fe = self.fg.add_item()
fe.title('y')
fe.geo.point('42.36 -71.05')
assert fe.geo.point() == '42.36 -71.05'
# Check that we have the item in the resulting XML
ns = {'georss': 'http://www.georss.org/georss'}
root = etree.fromstring(self.fg.rss_str())
point = root.xpath('/rss/channel/item/georss:point/text()',
namespaces=ns)
assert point == ['42.36 -71.05']