@@ -240,6 +240,7 @@ def test_download_issue_attachments_success(
240240 "mcp_atlassian.models.jira.JiraAttachment.from_api_response" ,
241241 side_effect = [mock_attachment1 , mock_attachment2 ],
242242 ),
243+ patch ("os.getcwd" , return_value = "/tmp" ),
243244 ):
244245 result = attachments_mixin .download_issue_attachments (
245246 "TEST-123" , "/tmp/attachments"
@@ -290,6 +291,7 @@ def test_download_issue_attachments_relative_path(
290291 ),
291292 patch ("os.path.isabs" ) as mock_isabs ,
292293 patch ("os.path.abspath" ) as mock_abspath ,
294+ patch ("os.getcwd" , return_value = "/absolute/path" ),
293295 ):
294296 mock_isabs .return_value = False
295297 mock_abspath .return_value = "/absolute/path/attachments"
@@ -311,7 +313,10 @@ def test_download_issue_attachments_no_attachments(
311313 mock_issue = {"fields" : {"attachment" : []}}
312314 attachments_mixin .jira .issue .return_value = mock_issue
313315
314- with patch ("pathlib.Path.mkdir" ) as mock_mkdir :
316+ with (
317+ patch ("pathlib.Path.mkdir" ) as mock_mkdir ,
318+ patch ("os.getcwd" , return_value = "/tmp" ),
319+ ):
315320 result = attachments_mixin .download_issue_attachments (
316321 "TEST-123" , "/tmp/attachments"
317322 )
@@ -329,9 +334,12 @@ def test_download_issue_attachments_issue_not_found(
329334 """Test download when issue cannot be retrieved."""
330335 attachments_mixin .jira .issue .return_value = None
331336
332- with pytest .raises (
333- TypeError ,
334- match = "Unexpected return value type from `jira.issue`: <class 'NoneType'>" ,
337+ with (
338+ patch ("os.getcwd" , return_value = "/tmp" ),
339+ pytest .raises (
340+ TypeError ,
341+ match = "Unexpected return value type from `jira.issue`: <class 'NoneType'>" ,
342+ ),
335343 ):
336344 attachments_mixin .download_issue_attachments ("TEST-123" , "/tmp/attachments" )
337345
@@ -343,9 +351,10 @@ def test_download_issue_attachments_no_fields(
343351 mock_issue = {} # Missing 'fields' key
344352 attachments_mixin .jira .issue .return_value = mock_issue
345353
346- result = attachments_mixin .download_issue_attachments (
347- "TEST-123" , "/tmp/attachments"
348- )
354+ with patch ("os.getcwd" , return_value = "/tmp" ):
355+ result = attachments_mixin .download_issue_attachments (
356+ "TEST-123" , "/tmp/attachments"
357+ )
349358
350359 # Assertions
351360 assert result ["success" ] is False
@@ -395,6 +404,7 @@ def test_download_issue_attachments_some_failures(
395404 "mcp_atlassian.models.jira.JiraAttachment.from_api_response" ,
396405 side_effect = [mock_attachment1 , mock_attachment2 ],
397406 ),
407+ patch ("os.getcwd" , return_value = "/tmp" ),
398408 ):
399409 result = attachments_mixin .download_issue_attachments (
400410 "TEST-123" , "/tmp/attachments"
@@ -439,6 +449,7 @@ def test_download_issue_attachments_missing_url(
439449 "mcp_atlassian.models.jira.JiraAttachment.from_api_response" ,
440450 return_value = mock_attachment ,
441451 ),
452+ patch ("os.getcwd" , return_value = "/tmp" ),
442453 ):
443454 result = attachments_mixin .download_issue_attachments (
444455 "TEST-123" , "/tmp/attachments"
0 commit comments