Mercurial > silorider
annotate tests/mockutil.py @ 2:27543b2e73b9
Add Twitter silo.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 29 Jul 2018 10:40:05 -0700 |
parents | |
children | b404445082f8 |
rev | line source |
---|---|
2 | 1 |
2 def mock_urllib(m): | |
3 import urllib.request | |
4 m.setattr(urllib.request, 'urlretrieve', _patched_urlretrieve) | |
5 m.setattr(urllib.request, 'urlcleanup', _patched_urlcleanup) | |
6 return m | |
7 | |
8 | |
9 def _patched_urlretrieve(url): | |
10 return ('/retrieved/' + url.lstrip('/'), None) | |
11 | |
12 | |
13 def _patched_urlcleanup(): | |
14 pass |