@@ -129,18 +129,18 @@ def test_validate_release_ticket_unexpected_error(self):
129129 validate_release_ticket (mock_jira , 'REL-123' )
130130 self .assertEqual (cm .exception .code , 1 )
131131
132- def test_create_integration_ticket_with_task_type (self ):
133- """Test creating integration ticket with Task issue type."""
132+ def test_create_integration_ticket_with_maintenance_type (self ):
133+ """Test creating integration ticket with Maintenance issue type."""
134134 mock_jira = Mock ()
135135 mock_project = Mock ()
136136 mock_jira .project .return_value = mock_project
137137
138- # Mock issue types with Task available
138+ # Mock issue types with Maintenance available
139139 mock_jira .createmeta .return_value = {
140140 'projects' : [{
141141 'issuetypes' : [
142142 {'name' : 'Bug' },
143- {'name' : 'Task ' },
143+ {'name' : 'Maintenance ' },
144144 {'name' : 'Story' }
145145 ]
146146 }]
@@ -164,7 +164,7 @@ def test_create_integration_ticket_with_task_type(self):
164164 # Verify the issue creation call
165165 call_args = mock_jira .create_issue .call_args [1 ]['fields' ]
166166 self .assertEqual (call_args ['project' ], 'INT' )
167- self .assertEqual (call_args ['issuetype' ], {'name' : 'Task ' })
167+ self .assertEqual (call_args ['issuetype' ], {'name' : 'Maintenance ' })
168168 self .assertEqual (call_args ['summary' ], 'Integration ticket for release' )
169169 self .assertNotIn ('description' , call_args ) # No description provided
170170
@@ -174,11 +174,11 @@ def test_create_integration_ticket_with_description(self):
174174 mock_project = Mock ()
175175 mock_jira .project .return_value = mock_project
176176
177- # Mock issue types with Task available
177+ # Mock issue types with Maintenance available
178178 mock_jira .createmeta .return_value = {
179179 'projects' : [{
180180 'issuetypes' : [
181- {'name' : 'Task ' }
181+ {'name' : 'Maintenance ' }
182182 ]
183183 }]
184184 }
@@ -201,7 +201,7 @@ def test_create_integration_ticket_with_description(self):
201201 # Verify the issue creation call does NOT include description
202202 call_args = mock_jira .create_issue .call_args [1 ]['fields' ]
203203 self .assertEqual (call_args ['project' ], 'INT' )
204- self .assertEqual (call_args ['issuetype' ], {'name' : 'Task ' })
204+ self .assertEqual (call_args ['issuetype' ], {'name' : 'Maintenance ' })
205205 self .assertEqual (call_args ['summary' ], 'Integration ticket for release' )
206206 self .assertNotIn ('description' , call_args )
207207
@@ -216,7 +216,7 @@ def test_create_integration_ticket_description_update_fails(self, mock_eprint):
216216 mock_jira .project .return_value = mock_project
217217
218218 mock_jira .createmeta .return_value = {
219- 'projects' : [{'issuetypes' : [{'name' : 'Task ' }]}]
219+ 'projects' : [{'issuetypes' : [{'name' : 'Maintenance ' }]}]
220220 }
221221
222222 mock_ticket = Mock ()
@@ -241,8 +241,77 @@ def test_create_integration_ticket_description_update_fails(self, mock_eprint):
241241 mock_ticket .update .assert_called_once_with (fields = {'description' : 'This description will fail to set' })
242242
243243 # noinspection DuplicatedCode
244+ def test_create_integration_ticket_with_feature_type (self ):
245+ """Test creating integration ticket with Feature issue type when Maintenance is not available."""
246+ mock_jira = Mock ()
247+ mock_project = Mock ()
248+ mock_jira .project .return_value = mock_project
249+
250+ # Mock issue types with only Feature available (no Bug)
251+ mock_jira .createmeta .return_value = {
252+ 'projects' : [{
253+ 'issuetypes' : [
254+ {'name' : 'Bug' },
255+ {'name' : 'Feature' },
256+ ]
257+ }]
258+ }
259+
260+ mock_ticket = Mock ()
261+ mock_ticket .key = 'INT-124'
262+ mock_jira .create_issue .return_value = mock_ticket
263+
264+ args = Mock ()
265+ args .target_jira_project = 'INT'
266+ args .ticket_summary = 'Integration ticket for release'
267+ args .ticket_description = None
268+
269+ result = create_integration_ticket (mock_jira , args )
270+
271+ self .assertEqual (result , mock_ticket )
272+
273+ # Verify the issue creation call - should use Feature
274+ call_args = mock_jira .create_issue .call_args [1 ]['fields' ]
275+ self .assertEqual (call_args ['issuetype' ], {'name' : 'Feature' })
276+
277+ # noinspection DuplicatedCode
278+ def test_create_integration_ticket_with_task_type (self ):
279+ """Test creating integration ticket with Task issue type when Maintenance and Feature is not available."""
280+ mock_jira = Mock ()
281+ mock_project = Mock ()
282+ mock_jira .project .return_value = mock_project
283+
284+ # Mock issue types with Task and Improvement available (no Bug)
285+ mock_jira .createmeta .return_value = {
286+ 'projects' : [{
287+ 'issuetypes' : [
288+ {'name' : 'Bug' },
289+ {'name' : 'Task' },
290+ {'name' : 'Improvement' },
291+ ]
292+ }]
293+ }
294+
295+ mock_ticket = Mock ()
296+ mock_ticket .key = 'INT-124'
297+ mock_jira .create_issue .return_value = mock_ticket
298+
299+ args = Mock ()
300+ args .target_jira_project = 'INT'
301+ args .ticket_summary = 'Integration ticket for release'
302+ args .ticket_description = None
303+
304+ result = create_integration_ticket (mock_jira , args )
305+
306+ self .assertEqual (result , mock_ticket )
307+
308+ # Verify the issue creation call - should use Feature
309+ call_args = mock_jira .create_issue .call_args [1 ]['fields' ]
310+ self .assertEqual (call_args ['issuetype' ], {'name' : 'Task' })
311+
312+ # noinspection DuplicatedCode
244313 def test_create_integration_ticket_with_improvement_type (self ):
245- """Test creating integration ticket with Improvement issue type when Task is not available."""
314+ """Test creating integration ticket with Improvement issue type when Maintenance, Feature and Task is not available."""
246315 mock_jira = Mock ()
247316 mock_project = Mock ()
248317 mock_jira .project .return_value = mock_project
@@ -270,7 +339,7 @@ def test_create_integration_ticket_with_improvement_type(self):
270339
271340 self .assertEqual (result , mock_ticket )
272341
273- # Verify the issue creation call - should use Improvement
342+ # Verify the issue creation call - should use Feature
274343 call_args = mock_jira .create_issue .call_args [1 ]['fields' ]
275344 self .assertEqual (call_args ['issuetype' ], {'name' : 'Improvement' })
276345
@@ -281,7 +350,7 @@ def test_create_integration_ticket_with_first_available_type(self):
281350 mock_project = Mock ()
282351 mock_jira .project .return_value = mock_project
283352
284- # Mock issue types with neither Task nor Story available
353+ # Mock issue types with neither Maintenance, Feature, Task, Improvement available
285354 mock_jira .createmeta .return_value = {
286355 'projects' : [{
287356 'issuetypes' : [
@@ -349,7 +418,7 @@ def test_create_integration_ticket_creation_error(self, mock_eprint):
349418 mock_jira .project .return_value = mock_project
350419
351420 mock_jira .createmeta .return_value = {
352- 'projects' : [{'issuetypes' : [{'name' : 'Task ' }]}]
421+ 'projects' : [{'issuetypes' : [{'name' : 'Maintenance ' }]}]
353422 }
354423
355424 mock_response = Mock ()
0 commit comments