Skip to content

Commit 43cee80

Browse files
committed
fix: fixing route and tests
1 parent ba39166 commit 43cee80

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ docker-compose down
4242

4343
5. For more information on the API endpoints and how to use them, please refer to the API documentation http://localhost:8000/api/v1/doc/.
4444

45-
![todo](todo.png)
45+
![todo](todo_api.png)

app/api/v1/resources/todo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
todo_parser.add_argument('status', type=str, default='todo')
2222

2323

24-
@api.route('todo/<int:todo_id>')
24+
@api.route('/todo/<int:todo_id>')
2525
class TodoResource(Resource):
2626
@api.doc('get_todo')
2727
@api.marshal_with(todo_model)

tests/test_todo_resource.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@ def create_todo(self, title="Test todo", description="Test todo description"):
4040

4141
def test_create_todo(self):
4242
response = self.client.post(
43-
"/api/v1/todos/",
43+
"/api/v1/todo",
4444
json={"title": "Test Todo", "description": "Test todo description"})
4545
self.assertEqual(response.status_code, 201)
4646

4747
def test_get_todos(self):
48-
response = self.client.get("/api/v1/todos/")
48+
response = self.client.get("/api/v1/todo")
4949
self.assertEqual(response.status_code, 200)
5050

5151
def test_update_todo(self):
5252
todo = self.create_todo()
5353

5454
response = self.client.put(
55-
f"/api/v1/todos/{todo.id}",
55+
f"/api/v1/todo/{todo.id}",
5656
data=json.dumps({"title": "Updated test todo",
5757
"description": "Updated test todo description"}),
5858
content_type="application/json",
@@ -61,18 +61,18 @@ def test_update_todo(self):
6161

6262
def test_delete_todo(self):
6363
todo = self.create_todo()
64-
response = self.client.delete(f"/api/v1/todos/{todo.id}")
64+
response = self.client.delete(f"/api/v1/todo/{todo.id}")
6565
self.assertEqual(response.status_code, 204)
6666

6767
def test_get_todo(self):
6868
todo = self.create_todo()
6969

70-
response = self.client.get(f"/api/v1/todos/{todo.id}")
70+
response = self.client.get(f"/api/v1/todo/{todo.id}")
7171
self.assertEqual(response.status_code, 200)
7272

7373
def test_invalid_input(self):
7474
response = self.client.post(
75-
"/api/v1/todos/",
75+
"/api/v1/todo",
7676
json={
7777
"description": "Test todo description",
7878
"done": False,
@@ -82,7 +82,7 @@ def test_invalid_input(self):
8282

8383
def test_update_nonexistent_todo(self):
8484
response = self.client.put(
85-
"/api/v1/todos/99999999",
85+
"/api/v1/todo/99999999",
8686
json={
8787
"title": "Updated test todo",
8888
"description": "Updated test todo description",
@@ -93,7 +93,7 @@ def test_update_nonexistent_todo(self):
9393

9494
def test_delete_nonexistent_todo(self):
9595
response = self.client.delete(
96-
"/api/v1/todos/99999999",
96+
"/api/v1/todo/99999999",
9797
json={
9898
"title": "Delete test todo",
9999
"description": "Delete test todo description",
File renamed without changes.

0 commit comments

Comments
 (0)