Skip to content

Commit

Permalink
add Tags routers tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vtecovsky committed Aug 12, 2023
1 parent f423f75 commit ccac3b5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
File renamed without changes.
30 changes: 30 additions & 0 deletions tests/app/test_tags_routers.py
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

1 comment on commit ccac3b5

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src
   exceptions.py31777%11, 24, 36, 48, 72, 84, 96
src/app/auth
   common.py281739%12–21, 25–32, 36–44, 49–50
   dependencies.py16662%33–38, 42
   jwt.py452936%25–27, 31–35, 39–43, 47–51, 55–63, 67–74
src/app/event_groups
   routes.py784345%25–27, 39–46, 86–90, 110, 152–178, 192–201, 219–228
src/app/users
   routes.py654334%43–45, 62–105, 124–129, 147–149, 170–175
src/repositories
   crud.py93990%86–91, 126, 139–140
src/repositories/event_groups
   repository.py57296%44–45
src/schemas
   events.py71692%48, 56, 79, 98–100
   tags.py40198%36
TOTAL129516387% 

Tests Skipped Failures Errors Time
53 0 💤 0 ❌ 0 🔥 14.947s ⏱️

Please sign in to comment.