This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
import json
|
||||
import threading
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
from urllib.parse import parse_qs
|
||||
from uuid import uuid4
|
||||
from unittest.mock import patch
|
||||
|
||||
@@ -410,7 +411,8 @@ def test_link_submission_posts_to_enabled_mastodon_plugin():
|
||||
def do_POST(self):
|
||||
received['path'] = self.path
|
||||
received['authorization'] = self.headers['Authorization']
|
||||
received['body'] = json.loads(self.rfile.read(int(self.headers['Content-Length'])))
|
||||
received['content_type'] = self.headers['Content-Type']
|
||||
received['body'] = parse_qs(self.rfile.read(int(self.headers['Content-Length'])).decode())
|
||||
self.send_response(200)
|
||||
self.send_header('Content-Type', 'application/json')
|
||||
self.end_headers()
|
||||
@@ -442,9 +444,8 @@ def test_link_submission_posts_to_enabled_mastodon_plugin():
|
||||
assert response.status_code == 201
|
||||
assert received['path'] == '/api/v1/statuses'
|
||||
assert received['authorization'] == 'Bearer test-token'
|
||||
assert received['body'] == {
|
||||
'status': 'A useful page\nWorth sharing\nFrom my #LinkLog: https://example.com/useful #python #web',
|
||||
}
|
||||
assert received['content_type'] == 'application/x-www-form-urlencoded'
|
||||
assert received['body'] == {'status': ['A useful page\nWorth sharing\nFrom my #LinkLog: https://example.com/useful #python #web']}
|
||||
finally:
|
||||
server.shutdown()
|
||||
thread.join()
|
||||
|
||||
Reference in New Issue
Block a user