kopia lustrzana https://github.com/snarfed/bridgy-fed
fix crash on followers/following pages with before/after query params
fixes https://console.cloud.google.com/errors/detail/CPnW-eq837TnswE;time=P30D?project=bridgy-federated , introduced in a140a60a7f
pull/424/head
rodzic
e4a85ab7ff
commit
f16338fc57
2
pages.py
2
pages.py
|
@ -118,7 +118,7 @@ def followers_or_following(domain, collection):
|
|||
return render_template(
|
||||
f'{collection}.html',
|
||||
util=util,
|
||||
**request.values,
|
||||
address=request.args.get('address'),
|
||||
**locals()
|
||||
)
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
"""Unit tests for pages.py."""
|
||||
from flask import get_flashed_messages
|
||||
from unittest.mock import patch
|
||||
|
||||
from oauth_dropins.webutil import util
|
||||
from oauth_dropins.webutil.testutil import requests_response
|
||||
from oauth_dropins.webutil.util import json_dumps, json_loads
|
||||
from flask import get_flashed_messages
|
||||
from granary import as2, atom, microformats2, rss
|
||||
from granary.tests.test_bluesky import REPLY_BSKY
|
||||
from granary.tests.test_as1 import (
|
||||
|
@ -15,6 +12,9 @@ from granary.tests.test_as1 import (
|
|||
LIKE,
|
||||
NOTE,
|
||||
)
|
||||
from oauth_dropins.webutil import util
|
||||
from oauth_dropins.webutil.testutil import requests_response
|
||||
from oauth_dropins.webutil.util import json_dumps, json_loads
|
||||
|
||||
import common
|
||||
from models import Object, Follower, User
|
||||
|
@ -137,6 +137,16 @@ class PagesTest(testutil.TestCase):
|
|||
got = self.client.get('/user/bar.com/following')
|
||||
self.assert_equals(404, got.status_code)
|
||||
|
||||
def test_following_before_empty(self):
|
||||
User.get_or_create('bar.com')
|
||||
got = self.client.get(f'/user/bar.com/following?before={util.now().isoformat()}')
|
||||
self.assert_equals(200, got.status_code)
|
||||
|
||||
def test_following_after_empty(self):
|
||||
User.get_or_create('bar.com')
|
||||
got = self.client.get(f'/user/bar.com/following?after={util.now().isoformat()}')
|
||||
self.assert_equals(200, got.status_code)
|
||||
|
||||
def test_feed_user_not_found(self):
|
||||
got = self.client.get('/user/bar.com/feed')
|
||||
self.assert_equals(404, got.status_code)
|
||||
|
|
Ładowanie…
Reference in New Issue