Skip to content

Commit

Permalink
[qa] fix reqparse not parsing bool type correctly (always True)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanBldy committed Oct 16, 2024
1 parent 6eb2161 commit e4eec17
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 18 deletions.
6 changes: 3 additions & 3 deletions zou/app/blueprints/assets/resources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import request
from flask_restful import Resource
from flask_restful import Resource, inputs
from flask_jwt_extended import jwt_required

from zou.app.utils import permissions, query
Expand Down Expand Up @@ -486,7 +486,7 @@ def get_arguments(self):
"is_shared",
True,
False,
bool,
inputs.boolean,
),
"episode_id",
]
Expand Down Expand Up @@ -688,7 +688,7 @@ def post(self, project_id=None, asset_type_id=None, asset_ids=None):
"is_shared",
True,
False,
bool,
inputs.boolean,
),
]
)
Expand Down
13 changes: 9 additions & 4 deletions zou/app/blueprints/news/resources.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from flask_restful import Resource
from flask_restful import Resource, inputs
from flask_jwt_extended import jwt_required

from zou.app.mixin import ArgsMixin
Expand All @@ -7,7 +7,7 @@
from zou.app.utils import permissions


class NewsMixin:
class NewsMixin(ArgsMixin):
def get_news(self, project_ids=[]):
(
only_preview,
Expand All @@ -21,7 +21,6 @@ def get_news(self, project_ids=[]):
before,
) = self.get_arguments()

user_service
after = self.parse_date_parameter(after)
before = self.parse_date_parameter(before)
result = news_service.get_last_news_for_project(
Expand All @@ -38,6 +37,7 @@ def get_news(self, project_ids=[]):
)
stats = news_service.get_news_stats_for_project(
project_ids=project_ids,
only_preview=only_preview,
task_type_id=task_type_id,
task_status_id=task_status_id,
episode_id=episode_id,
Expand All @@ -51,7 +51,12 @@ def get_news(self, project_ids=[]):
def get_arguments(self):
args = self.get_args(
[
{"name": "only_preview", "default": False, "type": bool},
(
"only_preview",
False,
False,
inputs.boolean,
),
"task_type_id",
"task_status_id",
"person_id",
Expand Down
6 changes: 3 additions & 3 deletions zou/app/blueprints/source/otio.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from string import Template

from flask import request, current_app
from flask_restful import Resource
from flask_restful import Resource, inputs
from flask_jwt_extended import jwt_required

from zou.app import config
Expand Down Expand Up @@ -308,7 +308,7 @@ def post_args(self):
False,
str,
),
("match_case", True, False, bool),
("match_case", True, False, inputs.boolean),
]
)

Expand Down Expand Up @@ -359,6 +359,6 @@ def post_args(self):
False,
str,
),
("match_case", True, False, bool),
("match_case", True, False, inputs.boolean),
]
)
8 changes: 6 additions & 2 deletions zou/app/blueprints/tasks/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


from flask import abort, request
from flask_restful import Resource
from flask_restful import Resource, inputs
from flask_jwt_extended import jwt_required

from zou.app.services.exception import (
Expand Down Expand Up @@ -793,7 +793,11 @@ def get_arguments(self):
("comment", ""),
("name", "main"),
{"name": "revision", "default": 1, "type": int},
{"name": "change_status", "default": True, "type": bool},
{
"name": "change_status",
"default": True,
"type": inputs.boolean,
},
]
)

Expand Down
12 changes: 6 additions & 6 deletions zou/app/blueprints/user/resources.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from flask import abort, request
from flask_restful import Resource
from flask_restful import Resource, inputs

from zou.app.mixin import ArgsMixin
from zou.app.services import (
Expand Down Expand Up @@ -556,7 +556,7 @@ def get_arguments(self):
("list_type", "todo", True),
("project_id", None, False),
("entity_type", None, False),
("is_shared", False, False, bool),
("is_shared", False, False, inputs.boolean),
("search_filter_group_id", None, False),
]
)
Expand Down Expand Up @@ -589,7 +589,7 @@ def put(self, filter_id):
("name", None, False),
("search_query", None, False),
("search_filter_group_id", None, False),
("is_shared", None, False, bool),
("is_shared", None, False, inputs.boolean),
("project_id", None, None),
]
)
Expand Down Expand Up @@ -695,7 +695,7 @@ def get_arguments(self):
("color", "", True),
("list_type", "todo", True),
("project_id", None, False),
("is_shared", False, False, bool),
("is_shared", False, False, inputs.boolean),
("entity_type", None, False),
]
)
Expand Down Expand Up @@ -741,7 +741,7 @@ def put(self, filter_group_id):
[
("name", None, False),
("color", None, False),
("is_shared", None, False, bool),
("is_shared", None, False, inputs.boolean),
("project_id", None, None),
]
)
Expand Down Expand Up @@ -919,7 +919,7 @@ def put(self, notification_id):
200:
description: Notification
"""
data = self.get_args([("read", None, False, bool)])
data = self.get_args([("read", None, False, inputs.boolean)])
return user_service.update_notification(notification_id, data["read"])


Expand Down

0 comments on commit e4eec17

Please sign in to comment.