From 0782605c9a6fbeb37e409e2d37009caaca33ee2b Mon Sep 17 00:00:00 2001 From: sidpremkumar Date: Sep 18 2019 23:19:27 +0000 Subject: Fix tests after merge #107 - changed transition line downstream --- diff --git a/tests/test_downstream.py b/tests/test_downstream.py index 549b390..972846a 100644 --- a/tests/test_downstream.py +++ b/tests/test_downstream.py @@ -571,11 +571,9 @@ class TestDownstream(unittest.TestCase): self.mock_issue ) - @mock.patch(PATH + 'datetime') @mock.patch('jira.client.JIRA') def test_update_transition_JIRAError(self, - mock_client, - mock_datetime): + mock_client): """ This function tests the '_update_transition' function where Upstream issue status s not in existing.fields.description and transitioning the issue throws an error @@ -583,7 +581,6 @@ class TestDownstream(unittest.TestCase): # Set up return values self.mock_issue.status = 'Closed' self.mock_downstream.fields.description = '' - mock_datetime.today.return_value = self.mock_today mock_client.transitions.return_value = [{'name': 'CUSTOM TRANSITION', 'id': '1234'}] mock_client.transition_issue.side_effect = JIRAError @@ -595,16 +592,14 @@ class TestDownstream(unittest.TestCase): ) # Assert all calls were made correctly - self.mock_today.strftime.assert_called_with("%a %b %y") - self.mock_downstream.update.assert_called_with({'description': '[mock_today] Upstream issue status: Closed\n'}) + self.mock_downstream.update.assert_called_with({'description': 'Upstream issue status: Closed\n'}) mock_client.transitions.assert_called_with(self.mock_downstream) mock_client.transition_issue.asert_called_with(self.mock_downstream, 1234) - @mock.patch(PATH + 'datetime') + @mock.patch('jira.client.JIRA') def test_update_transition_not_found(self, - mock_client, - mock_datetime): + mock_client): """ This function tests the '_update_transition' function where Upstream issue status s not in existing.fields.description and we can't find the appropriate closed status @@ -613,7 +608,6 @@ class TestDownstream(unittest.TestCase): self.mock_issue.status = 'Closed' self.mock_issue.downstream['transition'] = 'bad_transition' self.mock_downstream.fields.description = '' - mock_datetime.today.return_value = self.mock_today mock_client.transitions.return_value = [{'name': 'CUSTOM TRANSITION', 'id': '1234'}] # Call the function @@ -624,23 +618,19 @@ class TestDownstream(unittest.TestCase): ) # Assert all calls were made correctly - self.mock_today.strftime.assert_called_with("%a %b %y") - self.mock_downstream.update.assert_called_with({'description': '[mock_today] Upstream issue status: Closed\n'}) + self.mock_downstream.update.assert_called_with({'description': 'Upstream issue status: Closed\n'}) mock_client.transitions.assert_called_with(self.mock_downstream) mock_client.transition_issue.asert_called_with(self.mock_downstream, 1234) - @mock.patch(PATH + 'datetime') @mock.patch('jira.client.JIRA') def test_update_transition_successful(self, - mock_client, - mock_datetime): + mock_client): """ This function tests the '_update_transition' function where everything goes smoothly! """ # Set up return values self.mock_issue.status = 'Closed' self.mock_downstream.fields.description = '[test] Upstream issue status: Open' - mock_datetime.today.return_value = self.mock_today mock_client.transitions.return_value = [{'name': 'CUSTOM TRANSITION', 'id': '1234'}] # Call the function @@ -651,8 +641,7 @@ class TestDownstream(unittest.TestCase): ) # Assert all calls were made correctly - self.mock_today.strftime.assert_called_with("%a %b %y") - self.mock_downstream.update.assert_called_with({'description': '[mock_today] Upstream issue status: Closed'}) + self.mock_downstream.update.assert_called_with({'description': 'Upstream issue status: Closed'}) mock_client.transitions.assert_called_with(self.mock_downstream) mock_client.transition_issue.asert_called_with(self.mock_downstream, 1234)