feat: add interfaces of OAuth handler methods for authorization (#18889)
This commit is contained in:
parent
7ccec5cd95
commit
0e0ec4691a
3 changed files with 124 additions and 3 deletions
|
|
@ -0,0 +1,20 @@
|
|||
from werkzeug import Request
|
||||
from werkzeug.datastructures import Headers
|
||||
from werkzeug.test import EnvironBuilder
|
||||
|
||||
from core.plugin.impl.oauth import OAuthHandler
|
||||
|
||||
|
||||
def test_oauth_convert_request_to_raw_data():
|
||||
oauth_handler = OAuthHandler()
|
||||
builder = EnvironBuilder(
|
||||
method="GET",
|
||||
path="/test",
|
||||
headers=Headers({"Content-Type": "application/json"}),
|
||||
)
|
||||
request = Request(builder.get_environ())
|
||||
raw_request_bytes = oauth_handler._convert_request_to_raw_data(request)
|
||||
|
||||
assert b"GET /test HTTP/1.1" in raw_request_bytes
|
||||
assert b"Content-Type: application/json" in raw_request_bytes
|
||||
assert b"\r\n\r\n" in raw_request_bytes
|
||||
Loading…
Add table
Add a link
Reference in a new issue