flask: render: get tests working

flask
Ryan Barrett 2021-07-06 20:33:48 -07:00
rodzic fa2a970b2c
commit 86a4afdc97
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
3 zmienionych plików z 7 dodań i 6 usunięć

1
app.py
Wyświetl plik

@ -11,7 +11,6 @@ for module in (
'add_webmention',
'logs',
'redirect',
'render',
'salmon',
'superfeedr',
'webfinger',

Wyświetl plik

@ -20,10 +20,13 @@ app.wsgi_app = handlers.ndb_context_middleware(
cache = Cache(app)
def not_5xx(resp):
return isinstance(resp, tuple) and resp[1] // 100 != 5
@app.route('/render')
@cache.cached(timeout=CACHE_TIME.total_seconds(), query_string=True,
# don't cache 5xxes
response_filter=lambda resp: resp[1] // 100 != 5)
response_filter=not_5xx)
def render():
source = common.get_required_param(request, 'source')
target = common.get_required_param(request, 'target')

Wyświetl plik

@ -3,7 +3,7 @@
from oauth_dropins.webutil.util import json_dumps
from models import Response
from render import app
from render import app, cache
from . import testutil
client = app.test_client()
@ -13,8 +13,7 @@ class RenderTest(testutil.TestCase):
def setUp(self):
super(RenderTest, self).setUp()
app.config['TESTING'] = True
cache.clear()
self.as2 = {
'@context': 'https://www.w3.org/ns/activitystreams',
'type': 'Note',