Skip to content

Commit

Permalink
Update existing tests after 321ddb2
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperCraeghs committed Dec 7, 2023
1 parent 2a059d0 commit d62eb30
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/test_jira_juggler.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from dateutil import parser
from parameterized import parameterized
from collections import namedtuple

import unittest

Expand All @@ -33,6 +34,25 @@
from jira import JIRA


LinkType = namedtuple('LinkType', 'id name inward outward self')
ISSUE_LINK_TYPES = [
LinkType(
id="1000",
name="Duplicate",
inward="is duplicated by",
outward="duplicates",
self="http://www.example.com/jira/rest/api/2//issueLinkType/1000",
),
LinkType(
id="1010",
name="Blocker",
inward="is blocked by",
outward="blocks",
self="http://www.example.com/jira/rest/api/2//issueLinkType/1010",
),
]


class TestJiraJuggler(unittest.TestCase):
'''
Testing JiraJuggler interface
Expand Down Expand Up @@ -112,7 +132,10 @@ class TestJiraJuggler(unittest.TestCase):
"key": "{depends}"
}},
"type": {{
"name": "Blocker"
"name": "Blocker",
"id": "10031",
"inward": "is blocked by",
"outward": "blocks"
}}
}}
'''
Expand Down Expand Up @@ -271,6 +294,7 @@ def test_broken_depends(self, jira_mock):
'''Test for removing a broken link to a dependant task'''
jira_mock_object = MagicMock(spec=JIRA)
jira_mock.return_value = jira_mock_object
jira_mock_object.issue_link_types.return_value = ISSUE_LINK_TYPES
juggler = dut.JiraJuggler(self.URL, self.USER, self.PASSWD, self.QUERY)
self.assertEqual(self.QUERY, juggler.query)

Expand All @@ -291,6 +315,7 @@ def test_task_depends(self, jira_mock):
'''Test for dual happy flow: one task depends on the other'''
jira_mock_object = MagicMock(spec=JIRA)
jira_mock.return_value = jira_mock_object
jira_mock_object.issue_link_types.return_value = ISSUE_LINK_TYPES
juggler = dut.JiraJuggler(self.URL, self.USER, self.PASSWD, self.QUERY)
self.assertEqual(self.QUERY, juggler.query)

Expand Down Expand Up @@ -325,6 +350,7 @@ def test_task_double_depends(self, jira_mock):
'''Test for extended happy flow: one task depends on two others'''
jira_mock_object = MagicMock(spec=JIRA)
jira_mock.return_value = jira_mock_object
jira_mock_object.issue_link_types.return_value = ISSUE_LINK_TYPES
juggler = dut.JiraJuggler(self.URL, self.USER, self.PASSWD, self.QUERY)
self.assertEqual(self.QUERY, juggler.query)

Expand Down Expand Up @@ -370,6 +396,7 @@ def test_resolved_task(self, jira_mock):
Test that the most recent transition to the Approved/Resolved state is used to mark the end'''
jira_mock_object = MagicMock(spec=JIRA)
jira_mock.return_value = jira_mock_object
jira_mock_object.issue_link_types.return_value = ISSUE_LINK_TYPES
juggler = dut.JiraJuggler(self.URL, self.USER, self.PASSWD, self.QUERY)
histories = [
{
Expand Down Expand Up @@ -439,6 +466,7 @@ def test_closed_task(self, jira_mock):
'''
jira_mock_object = MagicMock(spec=JIRA)
jira_mock.return_value = jira_mock_object
jira_mock_object.issue_link_types.return_value = ISSUE_LINK_TYPES
juggler = dut.JiraJuggler(self.URL, self.USER, self.PASSWD, self.QUERY)
histories = [
{
Expand Down Expand Up @@ -476,6 +504,7 @@ def test_depend_on_preceding(self, jira_mock):
'''Test --depends-on-preceding, --weeklymax and --current-date options'''
jira_mock_object = MagicMock(spec=JIRA)
jira_mock.return_value = jira_mock_object
jira_mock_object.issue_link_types.return_value = ISSUE_LINK_TYPES
juggler = dut.JiraJuggler(self.URL, self.USER, self.PASSWD, self.QUERY)
histories = [
{
Expand Down

0 comments on commit d62eb30

Please sign in to comment.