Skip to content

Commit

Permalink
Implemented PR test patching suggestion
Browse files Browse the repository at this point in the history
  • Loading branch information
Vebop committed Aug 21, 2024
1 parent b200846 commit 4d00564
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions manager/api/tests/test_jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,17 @@ def test_needed_parameters(self):

mock_jira_patcher.stop()

def test_update_time_loss(self):
@patch("requests.get")
@patch("requests.put")
def test_update_time_loss(self, mock_get, mock_put):
"""Test call to update_time_loss and verify field was updated"""
# patch both requests.get, requests.put
mock_jira_patcher = patch("requests.get")
mock_jira_client = mock_jira_patcher.start()
response = requests.Response()
response.status_code = 200
response.json = lambda: {"customfield_10106": 13.6}
mock_jira_client.return_value = response
mock_put.return_value = response

mock_jira_patcher = patch("requests.put")
mock_jira_client = mock_jira_patcher.start()
response = requests.Response()
response.status_code = 200
mock_jira_client.return_value = response
response.json = lambda: {"customfield_10106": 13.6}
mock_get.return_value = response

# call update time lost
jira_response = update_time_loss(1, 3.4)
Expand Down

0 comments on commit 4d00564

Please sign in to comment.