-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 changed file
with
20 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
from httpx import AsyncClient | ||
|
||
from conduit.domain.dtos.article import ArticleDTO | ||
|
||
|
||
@pytest.mark.anyio | ||
async def test_empty_list_when_no_tags_exist(test_client: AsyncClient) -> None: | ||
response = await test_client.get(url="/tags") | ||
assert response.json() == {"tags": []} | ||
|
||
|
||
@pytest.mark.anyio | ||
async def test_list_of_tags_when_article_with_tags_exists( | ||
authorized_test_client: AsyncClient, test_article: ArticleDTO | ||
) -> None: | ||
response = await authorized_test_client.get(url="/tags") | ||
response_tags = response.json()["tags"] | ||
assert len(response_tags) == len(set(test_article.tags)) | ||
assert all(tag in test_article.tags for tag in response_tags) |