mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-06-28 06:41:43 +00:00
feat: read username if email is not available for oauth provider
Also add recipe for OAuth with GitHub setup
This commit is contained in:
@ -75,6 +75,17 @@ async def test_get_oauth_username(oauth: OAuth, mocker: MockerFixture) -> None:
|
||||
assert email == "email"
|
||||
|
||||
|
||||
async def test_get_oauth_username_empty_email(oauth: OAuth, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must read username if email is not available
|
||||
"""
|
||||
mocker.patch("aioauth_client.GoogleClient.get_access_token", return_value=("token", ""))
|
||||
mocker.patch("aioauth_client.GoogleClient.user_info", return_value=(aioauth_client.User(username="username"), ""))
|
||||
|
||||
username = await oauth.get_oauth_username("code")
|
||||
assert username == "username"
|
||||
|
||||
|
||||
async def test_get_oauth_username_exception_1(oauth: OAuth, mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must return None in case of OAuth request error (get_access_token)
|
||||
|
Reference in New Issue
Block a user