Mercurial > silorider
comparison tests/test_commands_populate.py @ 18:a921cc2306bc
Do our own HTML parsing/stripping of micropost contents.
- This lets us properly handle various forms of linking.
- Add tests for processing posts with links.
- Fix configuration in tests.
- Basic error handling for processing posts.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 16 Sep 2018 21:16:20 -0700 |
parents | a1b7a459326a |
children | b739ca5feb45 |
comparison
equal
deleted
inserted
replaced
17:678278cb85b1 | 18:a921cc2306bc |
---|---|
11 </article> | 11 </article> |
12 </body></html>""" | 12 </body></html>""" |
13 | 13 |
14 | 14 |
15 def test_populate(cli): | 15 def test_populate(cli): |
16 feed = cli.createTempFeed(feed1) | |
16 cli.appendSiloConfig('test', 'print', items='name') | 17 cli.appendSiloConfig('test', 'print', items='name') |
17 feed = cli.createTempFeed(feed1) | 18 cli.setFeedConfig('feed', feed) |
18 ctx, _ = cli.run('populate', feed, '-s', 'test') | 19 ctx, _ = cli.run('populate', '-s', 'test') |
19 assert ctx.cache.wasPosted('test', 'https://example.org/a-new-article') | 20 assert ctx.cache.wasPosted('test', 'https://example.org/a-new-article') |
20 | 21 |
21 | 22 |
22 feed2 = """ | 23 feed2 = """ |
23 <html><body> | 24 <html><body> |
38 </article> | 39 </article> |
39 </body></html>""" # NOQA | 40 </body></html>""" # NOQA |
40 | 41 |
41 | 42 |
42 def test_populate_until(cli): | 43 def test_populate_until(cli): |
44 feed = cli.createTempFeed(feed2) | |
43 cli.appendSiloConfig('test', 'print', items='name') | 45 cli.appendSiloConfig('test', 'print', items='name') |
44 feed = cli.createTempFeed(feed2) | 46 cli.setFeedConfig('feed', feed) |
45 ctx, _ = cli.run('populate', feed, '-s', 'test', '--until', '2018-01-08') | 47 ctx, _ = cli.run('populate', '-s', 'test', '--until', '2018-01-08') |
46 assert ctx.cache.wasPosted('test', 'https://example.org/first-article') | 48 assert ctx.cache.wasPosted('test', 'https://example.org/first-article') |
47 assert ctx.cache.wasPosted('test', 'https://example.org/second-article') | 49 assert ctx.cache.wasPosted('test', 'https://example.org/second-article') |
48 assert not ctx.cache.wasPosted('test', 'https://example.org/third-article') | 50 assert not ctx.cache.wasPosted('test', 'https://example.org/third-article') |