Skip to content

Commit

Permalink
Add swimlane to user story allowed_params (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
protoroto authored Jan 13, 2025
1 parent ad5d00d commit a7fd5b5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/185.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add missing swimlane to user story allowed_params
1 change: 1 addition & 0 deletions taiga/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ class UserStory(CustomAttributeResource, CommentableResource):
"due_date",
"generated_from_issue",
"generated_from_task",
"swimlane",
]

def add_task(self, subject, status, **attrs):
Expand Down
19 changes: 18 additions & 1 deletion tests/test_user_stories.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from taiga import TaigaAPI
from taiga.exceptions import TaigaException
from taiga.models import Task, UserStories, UserStory
from taiga.models import Project, SwimLane, Task, UserStories, UserStory, UserStoryStatus
from taiga.requestmaker import RequestMaker

from .tools import MockResponse, create_mock_json
Expand Down Expand Up @@ -140,3 +140,20 @@ def test_add_comment(self, mock_update):
user_story = UserStory(rm, id=1)
user_story.add_comment("hola")
mock_update.assert_called_with(comment="hola")

@patch("taiga.requestmaker.RequestMaker.put")
def test_swimlane_is_in_userstory_update_payload(self, mock_update):
rm = RequestMaker("/api/v1", "fakehost", "faketoken")
swimlane = SwimLane(rm, id=1)
project = Project(rm, id=1)
status_1 = UserStoryStatus(rm, id=1, project=project)
status_2 = UserStoryStatus(rm, id=2, project=project)
user_story = UserStory(rm, id=1, project=project.id, swimlane=swimlane.id, status=status_1)
user_story.status = 2
user_story.update()
mock_update.assert_called_with(
"/{endpoint}/{id}",
endpoint=UserStory.endpoint,
id=user_story.id,
payload={"project": project.id, "swimlane": swimlane.id, "status": status_2.id},
)

0 comments on commit a7fd5b5

Please sign in to comment.