Mercurial > silorider
view tests/mockutil.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 | 27543b2e73b9 |
children | b404445082f8 |
line wrap: on
line source
def mock_urllib(m): import urllib.request m.setattr(urllib.request, 'urlretrieve', _patched_urlretrieve) m.setattr(urllib.request, 'urlcleanup', _patched_urlcleanup) return m def _patched_urlretrieve(url): return ('/retrieved/' + url.lstrip('/'), None) def _patched_urlcleanup(): pass