1+ from datetime import date
2+
13import pytest
24import pytest_asyncio
35from httpx import AsyncClient
@@ -20,8 +22,11 @@ async def test_insert_libraries(session: AsyncSession, community: Community):
2022 library = Library (
2123 library_name = "Python" ,
222423- releases_url = "http://teste.com" ,
24- logo = "logo" ,
25+ logo = "http://teste.com" ,
26+ version = "3.12" ,
27+ release_date = date .today (),
28+ releases_doc_url = "http://teste.com" ,
29+ fixed_release_url = "http://teste.com" ,
2530 community_id = community .id ,
2631 )
2732 session .add (library )
@@ -34,8 +39,11 @@ async def test_insert_libraries(session: AsyncSession, community: Community):
3439 assert found is not None
3540 assert found .library_name == "Python"
3641 assert found .
user_email == "[email protected] " 37- assert found .releases_url == "http://teste.com"
38- assert found .logo == "logo"
42+ assert found .logo == "http://teste.com"
43+ assert found .version == "3.12"
44+ assert found .release_date == date .today ()
45+ assert found .releases_doc_url == "http://teste.com"
46+ assert found .fixed_release_url == "http://teste.com"
3947 assert found .community_id == community .id
4048
4149
@@ -45,8 +53,15 @@ async def test_post_libraries_endpoint(
4553):
4654 body = {
4755 "library_name" : "Python from API" ,
48- "releases_url" : "http://teste.com/" ,
56+ "news" : [
57+ {"tag" : "updates" , "description" : "New feature" },
58+ {"tag" : "bug_fix" , "description" : "Fixed bug" },
59+ ],
4960 "logo" : "http://teste.com/" ,
61+ "version" : "3.12" ,
62+ "release_date" : "2023-01-01" ,
63+ "releases_doc_url" : "http://teste.com/" ,
64+ "fixed_release_url" : "http://teste.com/" ,
5065 }
5166
5267 response = await async_client .post (
@@ -65,5 +80,10 @@ async def test_post_libraries_endpoint(
6580 created_library = result .first ()
6681
6782 assert created_library is not None
68- assert created_library .releases_url == body ["releases_url" ]
6983 assert created_library .logo == body ["logo" ]
84+ assert created_library .version == body ["version" ]
85+ assert created_library .release_date == date .fromisoformat (
86+ body ["release_date" ]
87+ )
88+ assert created_library .releases_doc_url == body ["releases_doc_url" ]
89+ assert created_library .fixed_release_url == body ["fixed_release_url" ]
0 commit comments