Skip to content

Commit

Permalink
Fix article tags list error
Browse files Browse the repository at this point in the history
  • Loading branch information
borys25ol committed Dec 11, 2024
1 parent 16b52d5 commit c9c3062
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conduit/infrastructure/repositories/article.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ def _to_article_dto(res: Any) -> ArticleDTO:
title=res.title,
description=res.description,
body=res.body,
tags=res.tags,
tags=res.tags.split(", ") if res.tags else [],
author=ArticleAuthorDTO(
username=res.username,
bio=res.bio,
Expand Down
20 changes: 20 additions & 0 deletions tests/api/routes/test_article.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,26 @@ async def test_user_can_create_article_with_existing_title(
assert response.status_code == 200


@pytest.mark.anyio
async def test_user_can_retrieve_article_without_tags(
authorized_test_client: AsyncClient,
) -> None:
payload = {
"article": {
"title": "Test Article",
"body": "test body",
"description": "test description",
"tagList": [],
}
}
response = await authorized_test_client.post(url="/articles", json=payload)
assert response.status_code == 200

article = ArticleResponse(**response.json())
response = await authorized_test_client.get(url=f"/articles/{article.article.slug}")
assert response.status_code == 200


@pytest.mark.anyio
async def test_user_can_not_retrieve_not_existing_article(
authorized_test_client: AsyncClient,
Expand Down

0 comments on commit c9c3062

Please sign in to comment.