mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-09-04 00:27:14 +00:00
This reverts commit d50957fc4f.
Co-authored-by: dadachann <185672915+dadachann@users.noreply.github.com>
This commit is contained in:
@@ -127,7 +127,7 @@ class SpaceService:
|
|||||||
def get_cloud_entry_url(self) -> str:
|
def get_cloud_entry_url(self) -> str:
|
||||||
"""Return the Space-owned Cloud selector for a Cloud Account login."""
|
"""Return the Space-owned Cloud selector for a Cloud Account login."""
|
||||||
|
|
||||||
return f'{self._get_space_config()["url"].rstrip("/")}/cloud?environment=beta&auto_launch=1'
|
return f'{self._get_space_config()["url"].rstrip("/")}/cloud?environment=beta'
|
||||||
|
|
||||||
async def exchange_oauth_code(
|
async def exchange_oauth_code(
|
||||||
self,
|
self,
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ async def space_oauth_api():
|
|||||||
application.space_service.get_oauth_authorize_url = Mock(
|
application.space_service.get_oauth_authorize_url = Mock(
|
||||||
side_effect=lambda redirect_uri, state: f'https://space.example/authorize?state={state}'
|
side_effect=lambda redirect_uri, state: f'https://space.example/authorize?state={state}'
|
||||||
)
|
)
|
||||||
application.space_service.get_cloud_entry_url = Mock(
|
application.space_service.get_cloud_entry_url = Mock(return_value='https://space.example/cloud?environment=beta')
|
||||||
return_value='https://space.example/cloud?environment=beta&auto_launch=1'
|
|
||||||
)
|
|
||||||
application.space_service.exchange_oauth_code = AsyncMock(
|
application.space_service.exchange_oauth_code = AsyncMock(
|
||||||
return_value={
|
return_value={
|
||||||
'access_token': 'space-access-token',
|
'access_token': 'space-access-token',
|
||||||
@@ -145,9 +143,7 @@ async def test_cloud_login_entry_redirects_to_space_workspace_launcher(space_oau
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert (await response.get_json())['data']['authorize_url'] == (
|
assert (await response.get_json())['data']['authorize_url'] == ('https://space.example/cloud?environment=beta')
|
||||||
'https://space.example/cloud?environment=beta&auto_launch=1'
|
|
||||||
)
|
|
||||||
application.space_service.get_cloud_entry_url.assert_called_once_with()
|
application.space_service.get_cloud_entry_url.assert_called_once_with()
|
||||||
application.user_service.issue_space_oauth_state.assert_not_awaited()
|
application.user_service.issue_space_oauth_state.assert_not_awaited()
|
||||||
|
|
||||||
|
|||||||
@@ -134,18 +134,6 @@ class TestSpaceServiceGetOAuthAuthorizeUrl:
|
|||||||
# Verify - uses default URL
|
# Verify - uses default URL
|
||||||
assert 'https://space.langbot.app/auth/authorize' in result
|
assert 'https://space.langbot.app/auth/authorize' in result
|
||||||
|
|
||||||
def test_cloud_entry_url_requests_automatic_launch(self):
|
|
||||||
"""Cloud's login entry must continue through the Space launcher."""
|
|
||||||
ap = SimpleNamespace(
|
|
||||||
instance_config=SimpleNamespace(
|
|
||||||
data={'space': {'url': 'https://space.example/base/'}},
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
result = SpaceService(ap).get_cloud_entry_url()
|
|
||||||
|
|
||||||
assert result == 'https://space.example/base/cloud?environment=beta&auto_launch=1'
|
|
||||||
|
|
||||||
|
|
||||||
class TestSpaceServiceGetUserByEmail:
|
class TestSpaceServiceGetUserByEmail:
|
||||||
"""Tests for _get_user_by_email internal method."""
|
"""Tests for _get_user_by_email internal method."""
|
||||||
|
|||||||
Reference in New Issue
Block a user