-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
101 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Gigya client for authentication.""" | ||
import logging | ||
|
||
from aiohttp import ClientSession | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
|
||
class Gigya(object): | ||
"""Gigya client for authentication.""" | ||
|
||
def __init__(self, websession: ClientSession) -> None: | ||
"""Initialise Gigya.""" | ||
self._websession = websession | ||
|
||
async def login(self, user: str, password: str) -> None: | ||
"""Send login to Gigya.""" | ||
pass | ||
|
||
async def get_person_id(self) -> str: | ||
"""Get person id.""" | ||
return "person_id" | ||
|
||
async def get_jwt_token(self) -> str: | ||
"""Get JWT token.""" | ||
return "jwt_token" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
"""Constants for the test suite fixtures.""" | ||
TEST_PASSWORD = "test_password" | ||
TEST_PERSON_ID = "person-id-1" | ||
TEST_USERNAME = "test@example.com" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
"""Test cases for the Renault client API keys.""" | ||
import pytest | ||
from aiohttp.client import ClientSession | ||
from tests.const import TEST_PASSWORD | ||
from tests.const import TEST_USERNAME | ||
|
||
from renault_api.gigya import Gigya | ||
|
||
|
||
@pytest.fixture | ||
def gigya(websession=ClientSession) -> Gigya: | ||
"""Fixture for testing Gigya.""" | ||
return Gigya(websession=websession) | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_login(gigya: Gigya) -> None: | ||
"""Test valid login response.""" | ||
await gigya.login(TEST_USERNAME, TEST_PASSWORD) | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_login_failed(gigya: Gigya) -> None: | ||
"""Test failed login response.""" | ||
pass | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_login_missing_session(gigya: Gigya) -> None: | ||
"""Test corrupted login response.""" | ||
pass | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_person_id(gigya: Gigya) -> None: | ||
"""Test valid getAccountInfo response.""" | ||
await gigya.login(TEST_USERNAME, TEST_PASSWORD) | ||
await gigya.get_person_id() | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_person_id_missing_data(gigya: Gigya) -> None: | ||
"""Test corrupted getAccountInfo response.""" | ||
pass | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_jwt_token(gigya: Gigya) -> None: | ||
"""Test valid getJWT response.""" | ||
await gigya.login(TEST_USERNAME, TEST_PASSWORD) | ||
await gigya.get_jwt_token() | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_jwt_token_missing_token(gigya: Gigya) -> None: | ||
"""Test corrupted getJWT response.""" | ||
pass |