diff --git a/src/routers/category.py b/src/routers/category.py index 73c8a16..5823da3 100644 --- a/src/routers/category.py +++ b/src/routers/category.py @@ -37,7 +37,7 @@ def get_error_response(e: Exception): } -@router.post("/categoria/", tags=["Categoria"], response_model=CategoryModel) +@router.post("/categoria", tags=["Categoria"], response_model=CategoryModel) async def post_category(data: CategoryModel, db: Session = Depends(get_db)): try: new_object = Category(**data.dict()) @@ -63,7 +63,7 @@ async def post_category(data: CategoryModel, db: Session = Depends(get_db)): ) -@router.get("/categoria/", tags=["Categoria"]) +@router.get("/categoria", tags=["Categoria"]) async def get_categories( category_id: Union[int, None] = None, db: Session = Depends(get_db) ): diff --git a/src/routers/problem.py b/src/routers/problem.py index daff9b7..4d2d2a5 100644 --- a/src/routers/problem.py +++ b/src/routers/problem.py @@ -39,7 +39,7 @@ def get_error_response(e: Exception): } -@router.get("/problema/", tags=["Problema"]) +@router.get("/problema", tags=["Problema"]) async def get_problems( problem_id: Union[int, None] = None, db: Session = Depends(get_db), @@ -97,7 +97,7 @@ async def get_problems( ) -@router.post("/problema/", tags=["Problema"], response_model=ProblemModel) +@router.post("/problema", tags=["Problema"], response_model=ProblemModel) async def post_problem(data: ProblemModel, db: Session = Depends(get_db)): try: problem = Problem(**data.dict()) diff --git a/tests/test_delete_category.py b/tests/test_delete_category.py index eeed104..3210a2a 100644 --- a/tests/test_delete_category.py +++ b/tests/test_delete_category.py @@ -5,7 +5,7 @@ def test_delete_category(client): response.json()["message"] == "Categoria de id = 10 deletada com sucesso" ) - verify = client.get("/categoria/?category_id=10") + verify = client.get("/categoria?category_id=10") assert verify.status_code == 200 assert not verify.json()["data"]["active"] diff --git a/tests/test_get_category.py b/tests/test_get_category.py index 916bcaf..83c34d1 100644 --- a/tests/test_get_category.py +++ b/tests/test_get_category.py @@ -1,10 +1,10 @@ def test_categoria(client): - response = client.get("/categoria/") + response = client.get("/categoria") assert response.status_code == 200 def test_categoria_id(client): - response = client.get("/categoria/?category_id=2") + response = client.get("/categoria?category_id=2") assert response.status_code == 200 assert response.json()["data"] == { "id": 2, @@ -16,6 +16,6 @@ def test_categoria_id(client): def test_categoria_id_not_found(client): - response = client.get("/categoria/?category_id=12") + response = client.get("/categoria?category_id=12") assert response.status_code == 200 assert response.json()["message"] == "Nenhuma categoria encontrada" diff --git a/tests/test_get_problem.py b/tests/test_get_problem.py index b7acbd3..745c4ed 100644 --- a/tests/test_get_problem.py +++ b/tests/test_get_problem.py @@ -1,5 +1,5 @@ def test_get_problem(client): - url = "/problema/" + url = "/problema" response = client.get(url) assert response.status_code == 200 # assert response.json() == { @@ -91,12 +91,12 @@ def test_get_problem(client): def test_get_problemid(client): - url = "/problema/?id=1" + url = "/problema?id=1" response = client.get(url) assert response.status_code == 200 def test_get_problemcategoryid(client): - url = "/problema/?category_id=1" + url = "/problema?category_id=1" response = client.get(url) assert response.status_code == 200 diff --git a/tests/test_post_category.py b/tests/test_post_category.py index 50e45fe..65d0856 100644 --- a/tests/test_post_category.py +++ b/tests/test_post_category.py @@ -1,12 +1,12 @@ def test_post_category(client): response = client.post( - "/categoria/", json={"name": "test", "description": "test"} + "/categoria", json={"name": "test", "description": "test"} ) assert response.status_code == 201 def test_post_category_invalid_name(client): response = client.post( - "/categoria/", json={"name": None, "description": "test"} + "/categoria", json={"name": None, "description": "test"} ) assert response.status_code == 422 diff --git a/tests/test_post_problem.py b/tests/test_post_problem.py index 33f44dd..1a14272 100644 --- a/tests/test_post_problem.py +++ b/tests/test_post_problem.py @@ -1,6 +1,6 @@ def test_post_problem(client): response = client.post( - "/problema/", + "/problema", json={"name": "test", "description": "test", "category_id": 1}, ) assert response.status_code == 201