Ryan Barrett 2024-01-10 12:39:19 -08:00
rodzic 34848b748e
commit ab4427c182
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 9 dodań i 8 usunięć

Wyświetl plik

@ -1946,7 +1946,7 @@ class WebTest(TestCase):
self.assertEqual(504, got.status_code)
self.assertIsNone(self.user.key.get().last_polled_feed)
def test_poll_feed_wrong_content_type(self, mock_get, _):
def test_poll_feed_wrong_content_types(self, mock_get, _):
common.RUN_TASKS_INLINE = False
self.user.obj.mf2 = {
**ACTOR_MF2,
@ -1956,12 +1956,12 @@ class WebTest(TestCase):
}
self.user.obj.put()
mock_get.return_value = requests_response(
'nope', headers={'Content-Type': 'text/plain'})
got = self.post('/queue/poll-feed', data={'domain': 'user.com'})
self.assertEqual(200, got.status_code)
self.assertIsNone(self.user.key.get().last_polled_feed)
for content_type in None, 'text/plain':
mock_get.return_value = requests_response(
'nope', headers={'Content-Type': content_type})
got = self.post('/queue/poll-feed', data={'domain': 'user.com'})
self.assertEqual(200, got.status_code)
self.assertIsNone(self.user.key.get().last_polled_feed)
@patch('oauth_dropins.webutil.appengine_config.tasks_client.create_task')
def test_poll_feed_last_webmention_in_noop(self, mock_create_task, mock_get, _):

3
web.py
Wyświetl plik

@ -613,6 +613,7 @@ def webmention_interactive():
@app.post(f'/queue/poll-feed')
@cloud_tasks_only
def poll_feed_task():
"""Fetches a :class:`Web` site's feed and delivers new/updated posts.
@ -639,7 +640,7 @@ def poll_feed_task():
# fetch feed
resp = util.requests_get(url)
content_type = resp.headers.get('Content-Type')
content_type = resp.headers.get('Content-Type') or ''
type = FEED_TYPES.get(content_type.split(';')[0])
if type == 'atom' or (type == 'xml' and rel_type == 'atom'):
activities = atom.atom_to_activities(resp.text)