Skip to content

Commit 40fbd97

Browse files
committed
TEST: Fix community fixture email credentials and DB value in news
1 parent 793223a commit 40fbd97

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/test_news.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from app.routers.news.routes import encode_email
1212
from app.services.database.models import Community, News
13+
from tests.conftest import CommunityCredentials
1314

1415

1516
@pytest_asyncio.fixture
@@ -19,7 +20,7 @@ async def news_list(community: Community) -> list[News]:
1920
title="Test news",
2021
content="A nova versão do Python traz melhorias ...",
2122
category="release",
22-
user_email=community.email,
23+
user_email=CommunityCredentials.email,
2324
source_url="https://python.org/news",
2425
tags="programming",
2526
social_media_url="https://linkedin.com/pythonista",
@@ -29,7 +30,7 @@ async def news_list(community: Community) -> list[News]:
2930
title="Test category",
3031
content="A nova versão do Python traz melhorias ...",
3132
category="test_category",
32-
user_email=community.email,
33+
user_email=CommunityCredentials.email,
3334
source_url="https://python.org/news",
3435
tags="programming",
3536
social_media_url="https://linkedin.com/pythonista",
@@ -50,7 +51,7 @@ async def news_list(community: Community) -> list[News]:
5051
title="Test id",
5152
content="FastAPI agora suporta novas funcionalidades ...",
5253
category="release",
53-
user_email=community.email,
54+
user_email=CommunityCredentials.email,
5455
source_url="https://fastapi.com/news",
5556
tags="programming",
5657
social_media_url="https://twitter.com/fastapi",
@@ -132,7 +133,7 @@ async def test_insert_news_via_post_news_endpoint(
132133
assert stored_news.title == news_data["title"]
133134
assert stored_news.content == news_data["content"]
134135
assert stored_news.category == news_data["category"]
135-
assert stored_news.user_email == community.email
136+
assert stored_news.user_email == CommunityCredentials.email
136137
assert stored_news.source_url == news_data["source_url"]
137138
assert stored_news.tags == news_data["tags"]
138139
assert stored_news.social_media_url == news_data["social_media_url"]
@@ -277,7 +278,7 @@ async def test_news_integration(
277278
assert data["news_list"][0]["title"] == news_data["title"]
278279
assert data["news_list"][0]["content"] == news_data["content"]
279280
assert data["news_list"][0]["category"] == news_data["category"]
280-
assert data["news_list"][0]["user_email"] == community.email
281+
assert data["news_list"][0]["user_email"] == CommunityCredentials.email
281282
assert data["news_list"][0]["source_url"] == news_data["source_url"]
282283
assert data["news_list"][0]["tags"] == news_data["tags"]
283284
assert (

0 commit comments

Comments
 (0)