| |
@@ -571,11 +571,9 @@
|
| |
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 @@
|
| |
# 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 @@
|
| |
)
|
| |
|
| |
# 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 @@
|
| |
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 @@
|
| |
)
|
| |
|
| |
# 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 @@
|
| |
)
|
| |
|
| |
# 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)
|
| |
|
| |
Test updates after Merge #107