Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add goal field to update/create sprint #1806

Merged
merged 10 commits into from
Mar 25, 2024
Prev Previous commit
Next Next commit
Fix up tests
  • Loading branch information
zbarahal committed Feb 4, 2024
commit 60b92e564380439b8500c6fcd64b089b5438d26e
4 changes: 2 additions & 2 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5077,9 +5077,9 @@ def create_sprint(
url = self._get_url("sprint", base=self.AGILE_BASE_URL)
payload["originBoardId"] = board_id
r = self._session.post(url, data=json.dumps(payload))
raw_issue_json = json_loads(r)
raw_sprint_json = json_loads(r)

return Sprint(self._options, self._session, raw=raw_issue_json)
return Sprint(self._options, self._session, raw=raw_sprint_json)

def add_issues_to_sprint(self, sprint_id: int, issue_keys: list[str]) -> Response:
"""Add the issues in ``issue_keys`` to the ``sprint_id``.
Expand Down
35 changes: 17 additions & 18 deletions tests/resources/test_sprint.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,28 +80,27 @@ def test_create_and_delete(self):
def test_create_with_goal(self):
# GIVEN: The board, sprint name, and goal
# WHEN: we create the sprint
with self._create_sprint() as sprint:
sprint = self.jira.create_sprint(
self.sprint_name, self.board.id, goal=self.goal
)
# THEN: we create the sprint with a goal
assert isinstance(sprint.id, int)
assert sprint.name == self.sprint_name
assert sprint.goal == self.sprint_goal
sprint = self.jira.create_sprint(self.sprint_name, self.board.id, goal=self.sprint_goal)
# THEN: we create the sprint with a goal
assert isinstance(sprint.id, int)
assert sprint.name == self.sprint_name
assert sprint.goal == self.sprint_goal

def test_update_sprint(self):
# GIVEN: The sprint ID
# WHEN: we update the sprint
with self._create_sprint() as sprint:
sprint = self.jira.create_sprint(
self.sprint_name, self.board.id, goal=self.goal
)
assert isinstance(sprint.id, int)
assert sprint.name == self.sprint_name
assert sprint.goal == self.sprint_goal
# THEN: the name changes
updated_sprint = self.jira.update_sprint(sprint.id, "new_name")
assert sprint["name"] == "new_name"
sprint = self.jira.create_sprint(self.sprint_name, self.board.id, goal=self.sprint_goal)
assert isinstance(sprint.id, int)
assert sprint.name == self.sprint_name
assert sprint.goal == self.sprint_goal
# THEN: the name changes
updated_sprint = self.jira.update_sprint(
sprint.id, "new_name",
state="future",
startDate="2015-04-11T15:22:00.000+10:00",
endDate="2015-04-20T01:22:00.000+10:00")
assert updated_sprint["name"] == "new_name"
>>>>>>> b490515 (Fix up tests)

def test_add_issue_to_sprint(self):
# GIVEN: The sprint
Expand Down
Loading