diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/mockutil.py	Sun Jul 29 10:40:05 2018 -0700
@@ -0,0 +1,14 @@
+
+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