-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
2616362
commit 42f9193
Showing
16 changed files
with
61 additions
and
3 deletions.
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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,45 @@ | ||
from aiohttp.test_utils import TestClient | ||
from sqlalchemy import select | ||
from sqlalchemy.ext.asyncio import AsyncSession | ||
from yarl import URL | ||
|
||
from industry_game.db.models import User | ||
from industry_game.utils.users.base import UserType | ||
|
||
API_URL = URL("/api/v1/players/register/") | ||
|
||
|
||
async def test_player_register_successful_status_created( | ||
api_client: TestClient, | ||
): | ||
response = await api_client.post( | ||
API_URL, | ||
json={ | ||
"username": "username", | ||
"password": "password", | ||
"telegram": "telegram", | ||
"name": "your name", | ||
}, | ||
) | ||
assert response.status == 201 | ||
|
||
|
||
async def test_player_register_successful_check_db( | ||
api_client: TestClient, | ||
session: AsyncSession, | ||
): | ||
await api_client.post( | ||
API_URL, | ||
json={ | ||
"username": "username", | ||
"password": "password", | ||
"telegram": "telegram", | ||
"name": "your name", | ||
}, | ||
) | ||
user = ( | ||
await session.scalars(select(User).where(User.username == "username")) | ||
).one() | ||
|
||
assert user.username == "username" | ||
assert user.type == UserType.PLAYER |
File renamed without changes.
File renamed without changes.
File renamed without changes.