annotate tests/mockutil.py @ 48:486affad656e
Rewrite posting process with card system and more structured API
- The basic posting process is more opinionated so that silos have less code to
write, and dry-run posting is handled by default.
- Add "card" system where SiloRider is able to fetch the page of a post to
check for any custom summary or featured image. This is how Twitter,
Facebook, Discord, and many others come up with their "preview card" when
a link is posted.
author |
Ludovic Chabant <ludovic@chabant.com> |
date |
Sun, 08 Oct 2023 13:47:28 -0700 |
parents |
27543b2e73b9 |
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
|