-
Notifications
You must be signed in to change notification settings - Fork 1
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
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
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,30 @@ | ||
import httpx | ||
import pytest | ||
|
||
from src.main import setup_repositories | ||
from tests.repositories.test_tags import get_fake_tag | ||
|
||
|
||
async def create_tag(tag_repository): | ||
await setup_repositories() | ||
tag_schema = get_fake_tag() | ||
tag = await tag_repository.create_or_read(tag_schema) | ||
return tag | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_list_tags(client: httpx.AsyncClient, tag_repository): | ||
tags = [] | ||
tags_number = 10 | ||
for i in range(tags_number): | ||
tag = await create_tag(tag_repository) | ||
tags.append(tag) | ||
response = await client.get("tags/") | ||
response_from_api = response.json() | ||
assert response.status_code == 200 | ||
for i in range(tags_number): | ||
assert response_from_api["tags"][i]["id"] == tags[i].id | ||
assert response_from_api["tags"][i]["alias"] == tags[i].alias | ||
assert response_from_api["tags"][i]["type"] == tags[i].type | ||
assert response_from_api["tags"][i]["name"] == tags[i].name | ||
assert len(response_from_api["tags"][i]["ownerships"]) == 0 |
ccac3b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report