From bdb1819e6794a072d113c8bbdf08ab2998d584f0 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Fri, 5 Oct 2012 07:13:54 -0400 Subject: [PATCH] test: add a test suite and simple testing script. It would probably be a good idea to use the unittest framework, but this works as a first pass. --- test/README | 45 ++++ test/allthingsrss/1.config | 3 + test/allthingsrss/1.expected | 398 +++++++++++++++++++++++++++++++++++ test/allthingsrss/README | 19 ++ test/allthingsrss/feed.atom | 248 ++++++++++++++++++++++ test/test.py | 106 ++++++++++ 6 files changed, 819 insertions(+) create mode 100644 test/README create mode 100644 test/allthingsrss/1.config create mode 100644 test/allthingsrss/1.expected create mode 100644 test/allthingsrss/README create mode 100644 test/allthingsrss/feed.atom create mode 100755 test/test.py diff --git a/test/README b/test/README new file mode 100644 index 0000000..de7d8ba --- /dev/null +++ b/test/README @@ -0,0 +1,45 @@ +Run tests with:: + + $ PYTHONPATH=. ./test/test.py + +Which looks for any ``*/feed.*`` files and processes them using each +``*.config`` file in the feed's directory. The output messages are +saved (not mailed) and compared with the expected output for that +feed/config pair. For example, with a directory structure like:: + + test + |-- README + |-- allthingsrss + | |-- 1.config + | |-- 1.expected + | |-- 2.config + | |-- 2.expected + | `-- feed.atom + |-- otherfeed + | |-- a.config + | |-- a.expected + | |-- b.config + | |-- b.expected + | `-- feed.rss + `-- test.py + +``test.py`` will parse: + +* ``feed.atom`` after loading ``1.config`` and compare the output with + ``1.expected``. +* ``feed.atom`` after loading ``2.config`` and compare the output with + ``2.expected``. +* ``feed.rss`` after loading ``a.config`` and compare the output with + ``a.expected``. +* ``feed.rss`` after loading ``b.config`` and compare the output with + ``b.expected``. + +If you only want to limit yourself to a subset of tests, you can +specify subdirectories on the command line:: + + $ PYTHONPATH=. ./test/test.py test/allthingsrss + +You can limit the tests even further by specify particular config +files:: + + $ PYTHONPATH=. ./test/test.py test/allthingsrss/1.config diff --git a/test/allthingsrss/1.config b/test/allthingsrss/1.config new file mode 100644 index 0000000..15935c4 --- /dev/null +++ b/test/allthingsrss/1.config @@ -0,0 +1,3 @@ +[DEFAULT] +to = a@b.com +date-header = True diff --git a/test/allthingsrss/1.expected b/test/allthingsrss/1.expected new file mode 100644 index 0000000..5bd9bb4 --- /dev/null +++ b/test/allthingsrss/1.expected @@ -0,0 +1,398 @@ +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Version 2.67 Released +Date: Tue, 21 Sep 2010 16:55:07 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=62 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/aGbf5Gefkmc/ +X-RSS-TAGS: Uncategorized + +Version 2.67 of rss2email is now available for both +[Linux](http://www.allthingsrss.com/rss2email/rss2email-2.67.tar.gz) and +[Windows](http://www.allthingsrss.com/rss2email/rss2email-2.67.zip), which +includes the latest development version of feedparser. Changes from the +previous version: + + * Fixed entries that include an id which is blank (i.e., an empty string) were being resent + * Fixed some entries not being sent by email because they had bad From headers + * Fixed From headers with HTML entities encoded twice + * Compatibility changes to support most recent development versions of feedparser + * Compatibility changes to support Google Reader feeds + +Complete list in the official +[CHANGELOG](http://www.allthingsrss.com/rss2email/changelog). + +[![](http://feedads.g.doubleclick.net/~a/Sjq8v- +Lq2dNKzkelsypiC4fjPLM/0/di)](http://feedads.g.doubleclick.net/~a/Sjq8v- +Lq2dNKzkelsypiC4fjPLM/0/da) + +[![](http://feedads.g.doubleclick.net/~a/Sjq8v- +Lq2dNKzkelsypiC4fjPLM/1/di)](http://feedads.g.doubleclick.net/~a/Sjq8v- +Lq2dNKzkelsypiC4fjPLM/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/aGbf5Gefkmc) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/aGbf5Gefkmc/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Version 2.68 Released with Actual New Features +Date: Fri, 01 Oct 2010 18:21:26 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=72 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/bT-I0iH2vw8/ +X-RSS-TAGS: Uncategorized + +Unlike the last few versions of rss2email that have trickled out, I finally +got around to adding a few new oft-requested features! Version 2.68 of +rss2email is now available for both +[Linux](http://www.allthingsrss.com/rss2email/rss2email-2.68.tar.gz) and +[Windows](http://www.allthingsrss.com/rss2email/rss2email-2.68.zip). + +Changes from the previous version: + + * Added ability to pause/resume checking of individual feeds through pause and unpause commands + * Added ability to import and export OPML feed lists through importopml and exportopml commands + +Complete list in the official +[CHANGELOG](http://www.allthingsrss.com/rss2email/changelog). + +**Pause/Unpause** + +Through `r2e pause _n_` where _n_ is a feed number, you can temporarily +suspend checking that feed for new content. To start checking it again, simply +run `r2e unpause _n_`. When you `r2e list`, an asterisk indicates that the +feed is currently unpaused and active. + +**OMPL Import/Export** + +[OPML](http://en.wikipedia.org/wiki/OPML) is an XML format commonly used to +exchange a list of RSS feeds between applications. `r2e opmlexport > +_filename_` will give you a file that you can use to import your list of feeds +into another application. If you've exported feeds from another application +into a file, `r2e opmlimport _filename_` will add those feeds to your +rss2email feed list. + +[![](http://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/0/di)](ht +tp://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/0/da) + +[![](http://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/1/di)](ht +tp://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/bT-I0iH2vw8) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/bT-I0iH2vw8/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: How to Read RSS Feeds in Emacs +Date: Fri, 05 Nov 2010 17:36:14 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=79 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/JryfOLe_q6c/ +X-RSS-TAGS: Uncategorized + +Emacs and rss2email user Erik Hetzner has written up a tutorial on how he +integrated [RSS feed reading into +Emacs](http://www.emacswiki.org/emacs/HOWTOReadFeedsInEmacsViaEmail) using +rss2email. + +[![](http://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/0/di)](ht +tp://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/0/da) + +[![](http://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/1/di)](ht +tp://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/JryfOLe_q6c) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/JryfOLe_q6c/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Version 2.69 Released +Date: Fri, 12 Nov 2010 18:45:08 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=85 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/ubaE55Le1OU/ +X-RSS-TAGS: Uncategorized + +Version 2.69 of rss2email is now available for both +[Linux](http://www.allthingsrss.com/rss2email/rss2email-2.69.tar.gz) and +[Windows](http://www.allthingsrss.com/rss2email/rss2email-2.69.zip). + +Changes from the previous version: + + * Added support for connecting to SMTP server via SSL, see SMTP_SSL option + * Improved backwards compatibility by fixing issue with listing feeds when run with older Python versions + * Added selective feed email overrides through OVERRIDE_EMAIL and DEFAULT_EMAIL options + * Added NO_FRIENDLY_NAME to from from address only without the friendly name + * Added X-RSS-URL header in each message with the link to the original item + +Complete list in the official +[CHANGELOG](http://www.allthingsrss.com/rss2email/changelog). + +[![](http://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/0/di)](ht +tp://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/0/da) + +[![](http://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/1/di)](ht +tp://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/ubaE55Le1OU) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/ubaE55Le1OU/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Minor Correction to v2.69 Packages +Date: Fri, 10 Dec 2010 17:47:58 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=88 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/CiODBX5_NSk/ +X-RSS-TAGS: Uncategorized + +The v2.69 rss2email packages contain an example config.py file that might +accidentally overwrite an existing config.py file. To keep this from happening +I've updated both the +[Linux](http://www.allthingsrss.com/rss2email/rss2email-2.69.tar.gz) and +[Windows](http://www.allthingsrss.com/rss2email/rss2email-2.69.zip) by simply +renaming the file to config.py.example. + +[![](http://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/0/di)](ht +tp://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/0/da) + +[![](http://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/1/di)](ht +tp://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/CiODBX5_NSk) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/CiODBX5_NSk/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Minor correction to the minor correction: v2.69a released +Date: Mon, 13 Dec 2010 18:04:20 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=95 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/VgWvylH6fvk/ +X-RSS-TAGS: Uncategorized + +Last week I made a [slight change to the v2.69 rss2email +packages](http://www.allthingsrss.com/rss2email/2010/12/minor-correction- +to-v2-69-packages/), which can cause suspicion that they have been tampered +with. To mitigate this, I put the original v2.69 files back in place and +renamed the updated package set to v2.69a. + +Here is v2.69a: +[Linux](http://www.allthingsrss.com/rss2email/rss2email-2.69a.tar.gz) and +[Windows](http://www.allthingsrss.com/rss2email/rss2email-2.69a.zip) + +And here is the original v2.69: +[Linux](http://www.allthingsrss.com/rss2email/rss2email-2.69.tar.gz) and +[Windows](http://www.allthingsrss.com/rss2email/rss2email-2.69.zip) + +[![](http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU- +SAzQ6UihM/0/di)](http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU- +SAzQ6UihM/0/da) + +[![](http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU- +SAzQ6UihM/1/di)](http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU- +SAzQ6UihM/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/VgWvylH6fvk) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/VgWvylH6fvk/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Mac OS X and rss2email are Compatible +Date: Fri, 17 Dec 2010 20:54:27 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=99 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/cILvxh4ziQg/ +X-RSS-TAGS: Uncategorized + +rss2email user Jon Thompson has reported that Linux rss2email works well under +Mac OS X. This is good news, but not to surprising since Apple based OS X on +UNIX. + +Technically the rss2email Linux package usually works on other UNIX-derived +OSs, such as CentOS and BSD. They aren't officially supported, but we usually +try resolve incompatibilities if possible. + +[![](http://feedads.g.doubleclick.net/~a/n8I- +3iyxNsT7ki6avOy7J2DFJk8/0/di)](http://feedads.g.doubleclick.net/~a/n8I- +3iyxNsT7ki6avOy7J2DFJk8/0/da) + +[![](http://feedads.g.doubleclick.net/~a/n8I- +3iyxNsT7ki6avOy7J2DFJk8/1/di)](http://feedads.g.doubleclick.net/~a/n8I- +3iyxNsT7ki6avOy7J2DFJk8/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/cILvxh4ziQg) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/cILvxh4ziQg/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Version 2.70 Released +Date: Tue, 21 Dec 2010 20:00:49 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=106 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/0rUaRcCJ8dU/ +X-RSS-TAGS: Uncategorized + +Version 2.70 of rss2email is now available for both +[Linux](http://www.allthingsrss.com/rss2email/rss2email-2.70.tar.gz) and +[Windows](http://www.allthingsrss.com/rss2email/rss2email-2.70.zip). + +Changes from the previous version: + + * Improved handling of given feed email addresses to prevent mail servers rejecting poorly formed Froms + * Added X-RSS-TAGS header that lists any tags provided by an entry, which will be helpful in filtering incoming messages + +Complete list in the official +[CHANGELOG](http://www.allthingsrss.com/rss2email/changelog). + +[![](http://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/0/di)](ht +tp://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/0/da) + +[![](http://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/1/di)](ht +tp://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/0rUaRcCJ8dU) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/0rUaRcCJ8dU/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Version 2.71 Release plus Other Major Updates +Date: Fri, 04 Mar 2011 18:03:11 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=123 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/wsLSVDNzno0/ +X-RSS-TAGS: Uncategorized + +Good news everyone! Two important tools that rss2email depends on have +recently received major upgrades: +[feedparser](http://code.google.com/p/feedparser/) and +[html2text](https://github.com/aaronsw/html2text). These should improve +rss2email's ability to handle feeds with poorly formed HTML and other +weirdness. + +The rss2email application itself also needed to be upgraded some to support +these. Changes in this version: + + * Upgraded to feedparser v5.01! (http://code.google.com/p/feedparser/) + * Upgraded to html2text v3.01! (https://github.com/aaronsw/html2text) + * Potentially safer method for writing feeds.dat on UNIX + * Handle via links with no title attribute + * Handle attributes more cleanly with OVERRIDE_EMAIL and DEFAULT_EMAIL + +[![](http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi- +IMAOP4LbS0/0/di)](http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi- +IMAOP4LbS0/0/da) + +[![](http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi- +IMAOP4LbS0/1/di)](http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi- +IMAOP4LbS0/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/wsLSVDNzno0) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/wsLSVDNzno0/ + +SENT TO: "rss2email: Lindsey Smith" +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Content-Transfer-Encoding: 7bit +From: "rss2email: Lindsey Smith" +To: a@b.com +Subject: Mac OS, rss2email and scheduling with launchd +Date: Tue, 23 Aug 2011 15:57:37 -0000 +User-Agent: rss2email +X-RSS-Feed: allthingsrss/feed.atom +X-RSS-ID: http://www.allthingsrss.com/rss2email/?p=131 +X-RSS-URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/0hb7cT3sLUM/ +X-RSS-TAGS: Uncategorized + +Just a little FYI if you encounter this: MacRumors user durlecs was having a +[problem scheduling rss2email with +launchd](http://forums.macrumors.com/showthread.php?t=1216694), Mac OS's built +in replacement for cron and other UNIX services. It looks like he/she got it +working in the end by adding the path to Python into the PATH environment +variable. + +[![](http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC- +_qJrGKA/0/di)](http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC- +_qJrGKA/0/da) + +[![](http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC- +_qJrGKA/1/di)](http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC- +_qJrGKA/1/da) + +![](http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/0hb7cT3sLUM) + + + +URL: http://feedproxy.google.com/~r/allthingsrss/hJBr/~3/0hb7cT3sLUM/ diff --git a/test/allthingsrss/README b/test/allthingsrss/README new file mode 100644 index 0000000..c24417a --- /dev/null +++ b/test/allthingsrss/README @@ -0,0 +1,19 @@ +feed.atom is a snapshot of + + http://feeds.feedburner.com/allthingsrss/hJBr + +as of 2012-10-04. + +HTTP headers: + + HTTP/1.1 200 OK + Content-Type: text/xml; charset=UTF-8 + ETag: Qki3L47sjALSTTcA3nJpJua1le8 + Last-Modified: Thu, 04 Oct 2012 22:06:19 GMT + Date: Thu, 04 Oct 2012 23:20:33 GMT + Expires: Thu, 04 Oct 2012 23:20:33 GMT + Cache-Control: private, max-age=0 + X-Content-Type-Options: nosniff + X-XSS-Protection: 1; mode=block + Server: GSE + Transfer-Encoding: chunked diff --git a/test/allthingsrss/feed.atom b/test/allthingsrss/feed.atom new file mode 100644 index 0000000..248fc68 --- /dev/null +++ b/test/allthingsrss/feed.atom @@ -0,0 +1,248 @@ + + + rss2email + a free, open-source tool for Windows and UNIX for getting news from RSS feeds in email + + 2011-08-23T15:57:37Z + + + http://www.allthingsrss.com/rss2email/feed/atom/ + + + WordPress + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Mac OS, rss2email and scheduling with launchd]]> + + http://www.allthingsrss.com/rss2email/?p=131 + 2011-08-23T15:57:37Z + 2011-08-23T15:57:37Z + + <p>Just a little FYI if you encounter this: MacRumors user durlecs was having a <a href="http://forums.macrumors.com/showthread.php?t=1216694" target="_blank">problem scheduling rss2email with launchd</a>, Mac OS&#8217;s built in replacement for cron and other UNIX services. It looks like he/she got it working in the end by adding the path to Python into the PATH environment variable.</p> + +<p><a href="http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC-_qJrGKA/0/da"><img src="http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC-_qJrGKA/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC-_qJrGKA/1/da"><img src="http://feedads.g.doubleclick.net/~a/0Q4e9-dkgHhcjqmhUxC-_qJrGKA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/0hb7cT3sLUM" height="1" width="1"/> + + + 1 + http://www.allthingsrss.com/rss2email/2011/08/mac-os-rss2email-and-scheduling-with-launchd/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Version 2.71 Release plus Other Major Updates]]> + + http://www.allthingsrss.com/rss2email/?p=123 + 2011-03-04T18:03:11Z + 2011-03-04T18:03:11Z + + <p>Good news everyone! Two important tools that rss2email depends on have recently received major upgrades: <a href="http://code.google.com/p/feedparser/">feedparser</a> and <a href="https://github.com/aaronsw/html2text">html2text</a>. These should improve rss2email&#8217;s ability to handle feeds with poorly formed HTML and other weirdness.</p> +<p>The rss2email application itself also needed to be upgraded some to support these. Changes in this version:</p> +<ul> +<li>Upgraded to feedparser v5.01! (http://code.google.com/p/feedparser/) +<li>Upgraded to html2text v3.01! (https://github.com/aaronsw/html2text) +<li>Potentially safer method for writing feeds.dat on UNIX +<li>Handle via links with no title attribute +<li>Handle attributes more cleanly with OVERRIDE_EMAIL and DEFAULT_EMAIL +</ul> + +<p><a href="http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi-IMAOP4LbS0/0/da"><img src="http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi-IMAOP4LbS0/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi-IMAOP4LbS0/1/da"><img src="http://feedads.g.doubleclick.net/~a/mPc_o2aCgPYkdQhi-IMAOP4LbS0/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/wsLSVDNzno0" height="1" width="1"/> + + + 62 + http://www.allthingsrss.com/rss2email/2011/03/version-2-71-release-plus-other-major-updates/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Version 2.70 Released]]> + + http://www.allthingsrss.com/rss2email/?p=106 + 2010-12-21T20:00:49Z + 2010-12-21T20:00:49Z + + <p>Version 2.70 of rss2email is now available for both <a href="http://www.allthingsrss.com/rss2email/rss2email-2.70.tar.gz">Linux</a> and <a href="http://www.allthingsrss.com/rss2email/rss2email-2.70.zip">Windows</a>.</p> +<p>Changes from the previous version:</p> +<ul> +<li>Improved handling of given feed email addresses to prevent mail servers rejecting poorly formed Froms +<li>Added X-RSS-TAGS header that lists any tags provided by an entry, which will be helpful in filtering incoming messages +</ul> +<p>Complete list in the official <a href="http://www.allthingsrss.com/rss2email/changelog">CHANGELOG</a>.</p> + +<p><a href="http://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/0/da"><img src="http://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/1/da"><img src="http://feedads.g.doubleclick.net/~a/3-mTadqlwiwGd3BGVmqYMI2xAyg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/0rUaRcCJ8dU" height="1" width="1"/> + + + 10 + http://www.allthingsrss.com/rss2email/2010/12/version-2-70-released/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Mac OS X and rss2email are Compatible]]> + + http://www.allthingsrss.com/rss2email/?p=99 + 2010-12-17T20:54:27Z + 2010-12-17T20:54:27Z + + <p>rss2email user Jon Thompson has reported that Linux rss2email works well under Mac OS X. This is good news, but not to surprising since Apple based OS X on UNIX.</p> +<p>Technically the rss2email Linux package usually works on other UNIX-derived OSs, such as CentOS and BSD. They aren&#8217;t officially supported, but we usually try resolve incompatibilities if possible.</p> + +<p><a href="http://feedads.g.doubleclick.net/~a/n8I-3iyxNsT7ki6avOy7J2DFJk8/0/da"><img src="http://feedads.g.doubleclick.net/~a/n8I-3iyxNsT7ki6avOy7J2DFJk8/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/n8I-3iyxNsT7ki6avOy7J2DFJk8/1/da"><img src="http://feedads.g.doubleclick.net/~a/n8I-3iyxNsT7ki6avOy7J2DFJk8/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/cILvxh4ziQg" height="1" width="1"/> + + + 8 + http://www.allthingsrss.com/rss2email/2010/12/mac-os-x-and-rss2email-are-compatible/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Minor correction to the minor correction: v2.69a released]]> + + http://www.allthingsrss.com/rss2email/?p=95 + 2010-12-13T18:04:20Z + 2010-12-13T18:04:20Z + + <p>Last week I made a <a href="http://www.allthingsrss.com/rss2email/2010/12/minor-correction-to-v2-69-packages/">slight change to the v2.69 rss2email packages</a>, which can cause suspicion that they have been tampered with. To mitigate this, I put the original v2.69 files back in place and renamed the updated package set to v2.69a.</p> +<p>Here is v2.69a: <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69a.tar.gz">Linux</a> and <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69a.zip">Windows</a><br /> +And here is the original v2.69: <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69.tar.gz">Linux</a> and <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69.zip">Windows</a></p> + +<p><a href="http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU-SAzQ6UihM/0/da"><img src="http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU-SAzQ6UihM/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU-SAzQ6UihM/1/da"><img src="http://feedads.g.doubleclick.net/~a/a817YdrxPE_g34wXU-SAzQ6UihM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/VgWvylH6fvk" height="1" width="1"/> + + + 1 + http://www.allthingsrss.com/rss2email/2010/12/minor-correction-to-the-minor-correction-v2-69a-released/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Minor Correction to v2.69 Packages]]> + + http://www.allthingsrss.com/rss2email/?p=88 + 2010-12-10T17:47:58Z + 2010-12-10T17:47:58Z + + <p>The v2.69 rss2email packages contain an example config.py file that might accidentally overwrite an existing config.py file. To keep this from happening I&#8217;ve updated both the <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69.tar.gz">Linux</a> and <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69.zip">Windows</a> by simply renaming the file to config.py.example.</p> + +<p><a href="http://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/0/da"><img src="http://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/1/da"><img src="http://feedads.g.doubleclick.net/~a/V9Hd_J59X3SfWg3Q2XbjLNcdusA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/CiODBX5_NSk" height="1" width="1"/> + + + 7 + http://www.allthingsrss.com/rss2email/2010/12/minor-correction-to-v2-69-packages/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Version 2.69 Released]]> + + http://www.allthingsrss.com/rss2email/?p=85 + 2010-11-12T18:45:08Z + 2010-11-12T18:45:08Z + + <p>Version 2.69 of rss2email is now available for both <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69.tar.gz">Linux</a> and <a href="http://www.allthingsrss.com/rss2email/rss2email-2.69.zip">Windows</a>.</p> +<p>Changes from the previous version:</p> +<ul> +<li>Added support for connecting to SMTP server via SSL, see SMTP_SSL option +<li>Improved backwards compatibility by fixing issue with listing feeds when run with older Python versions +<li>Added selective feed email overrides through OVERRIDE_EMAIL and DEFAULT_EMAIL options +<li>Added NO_FRIENDLY_NAME to from from address only without the friendly name +<li>Added X-RSS-URL header in each message with the link to the original item +</ul> +<p>Complete list in the official <a href="http://www.allthingsrss.com/rss2email/changelog">CHANGELOG</a>.</p> + +<p><a href="http://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/0/da"><img src="http://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/1/da"><img src="http://feedads.g.doubleclick.net/~a/ygS5IVjPi9xnNjTZA1SFTAzPtuA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/ubaE55Le1OU" height="1" width="1"/> + + + 10 + http://www.allthingsrss.com/rss2email/2010/11/version-2-69-released/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[How to Read RSS Feeds in Emacs]]> + + http://www.allthingsrss.com/rss2email/?p=79 + 2010-11-05T17:36:14Z + 2010-11-05T17:36:14Z + + <p>Emacs and rss2email user Erik Hetzner has written up a tutorial on how he integrated <a href="http://www.emacswiki.org/emacs/HOWTOReadFeedsInEmacsViaEmail">RSS feed reading into Emacs</a> using rss2email.</p> + +<p><a href="http://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/0/da"><img src="http://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/1/da"><img src="http://feedads.g.doubleclick.net/~a/W185EjeIKKNPfRCWp9sV0gDrfJk/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/JryfOLe_q6c" height="1" width="1"/> + + + 0 + http://www.allthingsrss.com/rss2email/2010/11/rss-in-emac/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Version 2.68 Released with Actual New Features]]> + + http://www.allthingsrss.com/rss2email/?p=72 + 2010-10-01T18:21:26Z + 2010-10-01T18:21:26Z + + <p>Unlike the last few versions of rss2email that have trickled out, I finally got around to adding a few new oft-requested features! Version 2.68 of rss2email is now available for both <a href="http://www.allthingsrss.com/rss2email/rss2email-2.68.tar.gz">Linux</a> and <a href="http://www.allthingsrss.com/rss2email/rss2email-2.68.zip">Windows</a>.</p> +<p>Changes from the previous version:</p> +<ul> +<li>Added ability to pause/resume checking of individual feeds through pause and unpause commands</li> +<li>Added ability to import and export OPML feed lists through importopml and exportopml commands</li> +</ul> +<p>Complete list in the official <a href="http://www.allthingsrss.com/rss2email/changelog">CHANGELOG</a>.</p> +<p><strong>Pause/Unpause</strong></p> +<p>Through <code>r2e pause <em>n</em></code> where <em>n</em> is a feed number, you can temporarily suspend checking that feed for new content. To start checking it again, simply run <code>r2e unpause <em>n</em></code>. When you <code>r2e list</code>, an asterisk indicates that the feed is currently unpaused and active.</p> +<p><strong>OMPL Import/Export</strong></p> +<p><a href="http://en.wikipedia.org/wiki/OPML">OPML</a> is an XML format commonly used to exchange a list of RSS feeds between applications. <code>r2e opmlexport &gt; <em>filename</em></code> will give you a file that you can use to import your list of feeds into another application. If you&#8217;ve exported feeds from another application into a file, <code>r2e opmlimport <em>filename</em></code> will add those feeds to your rss2email feed list.</p> + +<p><a href="http://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/0/da"><img src="http://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/1/da"><img src="http://feedads.g.doubleclick.net/~a/nYgTsIUsS9pmvRZ6092XGGHnNKg/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/bT-I0iH2vw8" height="1" width="1"/> + + + 17 + http://www.allthingsrss.com/rss2email/2010/10/version-2-68-released-with-actual-new-features/ + + + Lindsey Smith + http://www.gerundinganimal.com + + <![CDATA[Version 2.67 Released]]> + + http://www.allthingsrss.com/rss2email/?p=62 + 2010-09-21T16:55:07Z + 2010-09-21T16:55:07Z + + <p>Version 2.67 of rss2email is now available for both <a href="http://www.allthingsrss.com/rss2email/rss2email-2.67.tar.gz">Linux</a> and <a href="http://www.allthingsrss.com/rss2email/rss2email-2.67.zip">Windows</a>, which includes the latest development version of feedparser. Changes from the previous version:</p> +<ul> +<li>Fixed entries that include an id which is blank (i.e., an empty string) were being resent</li> +<li>Fixed some entries not being sent by email because they had bad From headers</li> +<li>Fixed From headers with HTML entities encoded twice</li> +<li>Compatibility changes to support most recent development versions of feedparser</li> +<li>Compatibility changes to support Google Reader feeds</li> +</ul> +<p>Complete list in the official <a href="http://www.allthingsrss.com/rss2email/changelog">CHANGELOG</a>.</p> +<ul></ul> + +<p><a href="http://feedads.g.doubleclick.net/~a/Sjq8v-Lq2dNKzkelsypiC4fjPLM/0/da"><img src="http://feedads.g.doubleclick.net/~a/Sjq8v-Lq2dNKzkelsypiC4fjPLM/0/di" border="0" ismap="true"></img></a><br/> +<a href="http://feedads.g.doubleclick.net/~a/Sjq8v-Lq2dNKzkelsypiC4fjPLM/1/da"><img src="http://feedads.g.doubleclick.net/~a/Sjq8v-Lq2dNKzkelsypiC4fjPLM/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/allthingsrss/hJBr/~4/aGbf5Gefkmc" height="1" width="1"/> + + + 1 + http://www.allthingsrss.com/rss2email/2010/09/version-2-67-released/ + diff --git a/test/test.py b/test/test.py new file mode 100755 index 0000000..fc26fc7 --- /dev/null +++ b/test/test.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python3 + +"""Test processing logic on known feeds. +""" + +import difflib as _difflib +import glob as _glob +import io as _io +import logging as _logging +import os as _os + +import rss2email as _rss2email + + +# Get a copy of the internal rss2email.CONFIG for copying +_stringio = _io.StringIO() +_rss2email.CONFIG.write(_stringio) +BASE_CONFIG_STRING = _stringio.getvalue() +del _stringio + + +class Send (list): + def __call__(self, sender, message): + self.append((sender, message)) + + def as_string(self): + chunks = [ + 'SENT TO: {}\n{}\n'.format(sender, message.as_string()) + for sender,message in self] + return '\n'.join(chunks) + + +def test(dirname=None, config_path=None, force=False): + if dirname is None: + dirname = _os.path.dirname(config_path) + if config_path is None: + _rss2email.LOG.info('testing {}'.format(dirname)) + for config_path in _glob.glob(_os.path.join(dirname, '*.config')): + test(dirname=dirname, config_path=config_path, force=force) + return + feed_path = _glob.glob(_os.path.join(dirname, 'feed.*'))[0] + _rss2email.LOG.info('testing {}'.format(config_path)) + config = _rss2email.Config() + config.read_string(BASE_CONFIG_STRING) + read_paths = config.read([config_path]) + feed = _rss2email.Feed(name='test', url=feed_path, config=config) + expected_path = config_path.replace('config', 'expected') + with open(expected_path, 'r') as f: + expected = f.read() + feed._send = Send() + feed.run() + generated = feed._send.as_string() + if force: + with open(expected_path, 'w') as f: + f.write(generated) + if generated != expected: + diff_lines = _difflib.unified_diff( + expected.splitlines(), generated.splitlines(), + 'expected', 'generated', lineterm='') + raise ValueError( + 'error processing {}\n{}'.format( + config_path, + '\n'.join(diff_lines))) + + +if __name__ == '__main__': + import argparse + + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument( + '--force', action='store_const', const=True, + help=( + "write output files (useful for figuring out what's expected " + 'from a new feed).')) + parser.add_argument( + '-V', '--verbose', default=0, action='count', + help='increment verbosity') + parser.add_argument( + 'dir', nargs='*', + help='select subdirs to test (tests all subdirs by default)') + + args = parser.parse_args() + + if args.verbose: + _rss2email.LOG.setLevel( + max(_logging.DEBUG, _logging.ERROR - 10 * args.verbose)) + + # no paths on the command line, find all subdirectories + this_dir = _os.path.dirname(__file__) + if not args.dir: + for basename in _os.listdir(this_dir): + path = _os.path.join(this_dir, basename) + if _os.path.isdir(path): + args.dir.append(path) + + # we need standardized URLs, so change to `this_dir` and adjust paths + orig_dir = _os.getcwd() + _os.chdir(this_dir) + + # run tests + for orig_path in args.dir: + this_path = _os.path.relpath(orig_path, start=this_dir) + if _os.path.isdir(this_path): + test(dirname=this_path, force=args.force) + else: + test(config_path=this_path, force=args.force) -- 2.26.2