quakkels / rssdiscoveryengine

The RSS Discovery Engine exists to encourage people to use RSS for finding and consuming their news and current events.
MIT License
159 stars 9 forks source link

Fix reinvention of `urlparse` in rssfinderhelpers.py. #7

Closed lewiscollard closed 3 years ago

lewiscollard commented 3 years ago

Previously, build_possible_rss_url was using string splitting to append parts onto the URL. It's much simpler to use urllib.parse.urlparse and replace URL components that way.

There was also another implementation of the same thing in rssdiscoveryengine_app.rssfinder.find_rss_url, which now uses the helper function.

As I wanted to validate that this did not change any behaviour, this PR also adds a tests directory and adds pytest to the requirements as a starting point for adding unit tests.

Driveby fix: rearrange some imports.