From cdbd7eca8a72a8902412143e19162e9f85d635aa Mon Sep 17 00:00:00 2001 From: Leonardo Cavallucci Date: Wed, 22 Jan 2025 16:56:15 +0100 Subject: [PATCH] Add missing due_date to Issue allowed_params (#197) --- changes/196.bugfix | 1 + taiga/models/models.py | 1 + tests/test_issues.py | 16 +++++++++++++++- tox.ini | 1 - 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 changes/196.bugfix diff --git a/changes/196.bugfix b/changes/196.bugfix new file mode 100644 index 0000000..1fbe6b0 --- /dev/null +++ b/changes/196.bugfix @@ -0,0 +1 @@ +Add missing due_date to Issue allowed_params diff --git a/taiga/models/models.py b/taiga/models/models.py index 75b43f7..76bfc26 100644 --- a/taiga/models/models.py +++ b/taiga/models/models.py @@ -959,6 +959,7 @@ class Issue(CustomAttributeResource, CommentableResource): "subject", "tags", "watchers", + "due_date", ] def list_attachments(self): diff --git a/tests/test_issues.py b/tests/test_issues.py index 15d6edd..c709026 100644 --- a/tests/test_issues.py +++ b/tests/test_issues.py @@ -2,7 +2,7 @@ from unittest.mock import patch from taiga.exceptions import TaigaException -from taiga.models import Issue, Issues +from taiga.models import Issue, Issues, Project from taiga.requestmaker import RequestMaker from .tools import MockResponse, create_mock_json @@ -96,3 +96,17 @@ def test_add_comment(self, mock_update): issue = Issue(rm, id=1) issue.add_comment("hola") mock_update.assert_called_with(comment="hola") + + @patch("taiga.requestmaker.RequestMaker.put") + def test_due_date_is_in_issue_update_payload(self, mock_update): + rm = RequestMaker("/api/v1", "fakehost", "faketoken") + project = Project(rm, id=1) + issue = Issue(rm, id=1, project=project.id) + issue.due_date = "2025-01-22" + issue.update() + mock_update.assert_called_with( + "/{endpoint}/{id}", + endpoint=Issue.endpoint, + id=issue.id, + payload={"project": project.id, "due_date": issue.due_date}, + ) diff --git a/tox.ini b/tox.ini index 4c2320c..8f107e1 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,6 @@ envlist = pypi-description towncrier py{311,310,39} - py{311,310,39} [testenv] commands = {env:COMMAND:python} -m pytest {posargs}