add failing test for issue #5

We do not need to see the output of that feed, actually: we just want
to parse it. Therefore, make sure we can test any .xml file provided
even if it does not have a matching .mbx.

It is a little strange we test parsing of all feeds in the mbx plugin,
but since we do it anyways, I don't see why it should be moved out of
there.
parent 63f75c6b
<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title>RSS Feed</title>
<link>https://www.proto.utwente.nl/ical/calendar</link>
<description>Generated from iCal</description>
<item>
<title>The amACEing RACE</title>
<description>Sign-up required! There are roughly 22 of 24 places left. Moreinformation: https://www.proto.utwente.nl/events/J3v6eObPekm7k0Vj</description>
<guid isPermaLink="false">856@proto.utwente.nl</guid>
</item>
<item>
<title>Active Member Activity</title>
<description>Sign-up required! There are roughly 45 of 60 places left. Moreinformation: https://www.proto.utwente.nl/events/7QYOZym0l3m8Gz9p</description>
<guid isPermaLink="false">953@proto.utwente.nl</guid>
</item>
<item>
<title>E3 Viewing Party</title>
<description>Sign-up required, but no participant limit. More information:https://www.proto.utwente.nl/events/kxM75oR3krRQDepw</description>
<guid isPermaLink="false">987@proto.utwente.nl</guid>
</item>
<item>
<title>[External] Kick 'EM master mentor interest drink</title>
<description>No sign-up necessary. This activity is not organised by S.A.Proto More information:https://www.proto.utwente.nl/events/0zeyJ31GWp1Apj4k</description>
<guid isPermaLink="false">988@proto.utwente.nl</guid>
</item>
</channel>
</rss>
......@@ -132,13 +132,19 @@ def test_email(tmpdir, feed_manager, static_boundary, betamax): # noqa
'filter_args': 'Trump'})
body = betamax.get(feed['url']).content
feed_manager.dispatch(feed, feed.parse(body), lock=LOCK)
p = path[:-3] + 'mbx'
with open(p) as expected:
folder = utils.slug(feed['name']) + '.mbx'
r = re.compile('User-Agent: .*$', flags=re.MULTILINE)
actual = r.sub('', tmpdir.join('Mail', folder).read())
expect = r.sub('', expected.read())
assert actual
folder = utils.slug(feed['name']) + '.mbx'
ua_pattern = re.compile('User-Agent: .*$', flags=re.MULTILINE)
actual = ua_pattern.sub('', tmpdir.join('Mail', folder).read())
assert actual
mbox_path = path[:-3] + 'mbx'
try:
with open(mbox_path) as expected:
expect = ua_pattern.sub('', expected.read())
except FileNotFoundError:
# ignore missing mailbox samples
pass
else:
assert expect == actual
assert path
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment