Skip to content

Commit

Permalink
add test case for new namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
exxamalte committed Dec 30, 2020
1 parent 9920071 commit df21987
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/fixtures/generic_feed_8.xml
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:emsc="https://www.emsc-csem.org"
xmlns:geo="http://www.w3.org/2003/01/geo/" version="2.0">
<channel>
<item>
<title>Title 1</title>
<pubDate>2018-09-23 08:30:00</pubDate>
<guid>1234</guid>
<category>Category 1</category>
<geo:long>149.1234</geo:long>
<geo:lat>-37.2345</geo:lat>
</item>
</channel>
</rss>
28 changes: 28 additions & 0 deletions tests/test_feed.py
Expand Up @@ -229,6 +229,34 @@ async def test_update_duplicate_geometries(aresponses, event_loop):
assert isinstance(feed_entry.geometries[1], BoundingBox)


@pytest.mark.asyncio
async def test_update_ok_feed_8(aresponses, event_loop):
"""Test updating feed is ok."""
aresponses.add(
"test.url",
"/testpath",
"get",
aresponses.Response(text=load_fixture("generic_feed_8.xml"), status=200),
)

async with aiohttp.ClientSession(loop=event_loop) as websession:

feed = MockGeoRssFeed(
websession, HOME_COORDINATES_1, "http://test.url/testpath"
)
status, entries = await feed.update()
assert status == UPDATE_OK
assert entries is not None
assert len(entries) == 1

feed_entry = entries[0]
assert feed_entry.title == "Title 1"
assert feed_entry.external_id == "1234"
assert feed_entry.category == "Category 1"
assert feed_entry.coordinates == (-37.2345, 149.1234)
assert round(abs(feed_entry.distance_to_home - 714.4), 1) == 0


@pytest.mark.asyncio
async def test_update_ok_with_radius_filtering(aresponses, event_loop):
"""Test updating feed is ok."""
Expand Down

0 comments on commit df21987

Please sign in to comment.