Skip to content

Commit c1a31bb

Browse files
committed
[FIX] PUT /api/v2/cases/{case_identifier}/tasks/ (with a slash) should return 404
1 parent 6f8b47e commit c1a31bb

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

source/app/blueprints/rest/v2/cases/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
__name__,
3434
url_prefix='/<int:case_id>/tasks')
3535

36-
@case_tasks_blueprint.post('', strict_slashes=False)
36+
@case_tasks_blueprint.post('')
3737
@ac_api_requires()
3838
def add_case_task(case_id):
3939
"""

tests/tests_rest_tasks.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ def test_add_task_with_missing_task_title_identifier_should_return_400(self):
4444
response = self._subject.create(f'/api/v2/cases/{case_identifier}/tasks', body)
4545
self.assertEqual(400, response.status_code)
4646

47+
def test_create_case_with_spurious_slash_should_return_404(self):
48+
case_identifier = self._subject.create_dummy_case()
49+
body = {'task_assignees_id': [1], 'task_description': '', 'task_status_id': 1, 'task_tags': '',
50+
'task_title': 'dummy title', 'custom_attributes': {}}
51+
response = self._subject.create(f'/api/v2/cases/{case_identifier}/tasks/', body)
52+
self.assertEqual(404, response.status_code)
53+
4754
def test_get_task_should_return_201(self):
4855
case_identifier = self._subject.create_dummy_case()
4956
body = {'task_assignees_id': [2], 'task_description': '', 'task_status_id': 1, 'task_tags': '',

0 commit comments

Comments
 (0)