mirror of
https://github.com/home-assistant/core.git
synced 2025-07-18 10:47:10 +00:00
parent
d1ad2cc225
commit
81e21b90c9
@ -344,11 +344,12 @@ class AuthorizeView(HomeAssistantView):
|
|||||||
_is_latest(self.js_option, request)
|
_is_latest(self.js_option, request)
|
||||||
|
|
||||||
if latest:
|
if latest:
|
||||||
location = '/frontend_latest/authorize.html'
|
base = 'frontend_latest'
|
||||||
else:
|
else:
|
||||||
location = '/frontend_es5/authorize.html'
|
base = 'frontend_es5'
|
||||||
|
|
||||||
location += '?{}'.format(request.query_string)
|
location = "/{}/authorize.html{}".format(
|
||||||
|
base, str(request.url.relative())[15:])
|
||||||
|
|
||||||
return web.Response(status=302, headers={
|
return web.Response(status=302, headers={
|
||||||
'location': location
|
'location': location
|
||||||
|
@ -294,10 +294,18 @@ async def test_onboarding_load(mock_http_client):
|
|||||||
|
|
||||||
async def test_auth_authorize(mock_http_client):
|
async def test_auth_authorize(mock_http_client):
|
||||||
"""Test the authorize endpoint works."""
|
"""Test the authorize endpoint works."""
|
||||||
resp = await mock_http_client.get('/auth/authorize?hello=world')
|
resp = await mock_http_client.get(
|
||||||
assert resp.url.query_string == 'hello=world'
|
'/auth/authorize?response_type=code&client_id=https://localhost/&'
|
||||||
assert resp.url.path == '/frontend_es5/authorize.html'
|
'redirect_uri=https://localhost/&state=123%23456')
|
||||||
|
|
||||||
resp = await mock_http_client.get('/auth/authorize?latest&hello=world')
|
assert str(resp.url.relative()) == (
|
||||||
assert resp.url.query_string == 'latest&hello=world'
|
'/frontend_es5/authorize.html?response_type=code&client_id='
|
||||||
assert resp.url.path == '/frontend_latest/authorize.html'
|
'https://localhost/&redirect_uri=https://localhost/&state=123%23456')
|
||||||
|
|
||||||
|
resp = await mock_http_client.get(
|
||||||
|
'/auth/authorize?latest&response_type=code&client_id='
|
||||||
|
'https://localhost/&redirect_uri=https://localhost/&state=123%23456')
|
||||||
|
|
||||||
|
assert str(resp.url.relative()) == (
|
||||||
|
'/frontend_latest/authorize.html?latest&response_type=code&client_id='
|
||||||
|
'https://localhost/&redirect_uri=https://localhost/&state=123%23456')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user