@@ -324,6 +324,62 @@ func TestListIssuesSearchInDescription(t *testing.T) {
324
324
t .Errorf ("Issues.ListIssues returned %+v, want %+v" , issues , want )
325
325
}
326
326
}
327
+
328
+ func TestListIssuesSearchByIterationID (t * testing.T ) {
329
+ mux , server , client := setup (t )
330
+ defer teardown (server )
331
+
332
+ mux .HandleFunc ("/api/v4/issues" , func (w http.ResponseWriter , r * http.Request ) {
333
+ testMethod (t , r , http .MethodGet )
334
+ testURL (t , r , "/api/v4/issues?iteration_id=90" )
335
+ fmt .Fprint (w , `
336
+ [
337
+ {
338
+ "id": 1,
339
+ "title": "A Test Issue Title",
340
+ "description": "This is the description for the issue",
341
+ "iteration": {
342
+ "id":90,
343
+ "iid":4,
344
+ "sequence":2,
345
+ "group_id":162,
346
+ "state":2,
347
+ "web_url":"https://gitlab.com/groups/my-group/-/iterations/90"
348
+ }
349
+ }
350
+ ]` ,
351
+ )
352
+ })
353
+
354
+ listProjectIssue := & ListIssuesOptions {
355
+ IterationID : Int (90 ),
356
+ }
357
+
358
+ issues , _ , err := client .Issues .ListIssues (listProjectIssue )
359
+
360
+ if err != nil {
361
+ log .Fatal (err )
362
+ }
363
+
364
+ want := []* Issue {{
365
+ ID : 1 ,
366
+ Title : "A Test Issue Title" ,
367
+ Description : "This is the description for the issue" ,
368
+ Iteration : & GroupIteration {
369
+ ID : 90 ,
370
+ IID : 4 ,
371
+ Sequence : 2 ,
372
+ GroupID : 162 ,
373
+ State : 2 ,
374
+ WebURL : "https://gitlab.com/groups/my-group/-/iterations/90" ,
375
+ },
376
+ }}
377
+
378
+ if ! reflect .DeepEqual (want , issues ) {
379
+ t .Errorf ("Issues.ListIssues returned %+v, want %+v" , issues , want )
380
+ }
381
+ }
382
+
327
383
func TestListProjectIssues (t * testing.T ) {
328
384
mux , server , client := setup (t )
329
385
defer teardown (server )
@@ -355,6 +411,61 @@ func TestListProjectIssues(t *testing.T) {
355
411
}
356
412
}
357
413
414
+ func TestListProjectIssuesSearchByIterationID (t * testing.T ) {
415
+ mux , server , client := setup (t )
416
+ defer teardown (server )
417
+
418
+ mux .HandleFunc ("/api/v4/projects/1/issues" , func (w http.ResponseWriter , r * http.Request ) {
419
+ testMethod (t , r , http .MethodGet )
420
+ testURL (t , r , "/api/v4/projects/1/issues?iteration_id=90" )
421
+ fmt .Fprint (w , `
422
+ [
423
+ {
424
+ "id": 1,
425
+ "title": "A Test Issue Title",
426
+ "description": "This is the description for the issue",
427
+ "iteration": {
428
+ "id":90,
429
+ "iid":4,
430
+ "sequence":2,
431
+ "group_id":162,
432
+ "state":2,
433
+ "web_url":"https://gitlab.com/groups/my-group/-/iterations/90"
434
+ }
435
+ }
436
+ ]` ,
437
+ )
438
+ })
439
+
440
+ listProjectIssue := & ListProjectIssuesOptions {
441
+ IterationID : Int (90 ),
442
+ }
443
+
444
+ issues , _ , err := client .Issues .ListProjectIssues (1 ,listProjectIssue )
445
+
446
+ if err != nil {
447
+ log .Fatal (err )
448
+ }
449
+
450
+ want := []* Issue {{
451
+ ID : 1 ,
452
+ Title : "A Test Issue Title" ,
453
+ Description : "This is the description for the issue" ,
454
+ Iteration : & GroupIteration {
455
+ ID : 90 ,
456
+ IID : 4 ,
457
+ Sequence : 2 ,
458
+ GroupID : 162 ,
459
+ State : 2 ,
460
+ WebURL : "https://gitlab.com/groups/my-group/-/iterations/90" ,
461
+ },
462
+ }}
463
+
464
+ if ! reflect .DeepEqual (want , issues ) {
465
+ t .Errorf ("Issues.ListIssues returned %+v, want %+v" , issues , want )
466
+ }
467
+ }
468
+
358
469
func TestListGroupIssues (t * testing.T ) {
359
470
mux , server , client := setup (t )
360
471
defer teardown (server )
@@ -388,6 +499,61 @@ func TestListGroupIssues(t *testing.T) {
388
499
}
389
500
}
390
501
502
+ func TestListGroupIssuesSearchByIterationID (t * testing.T ) {
503
+ mux , server , client := setup (t )
504
+ defer teardown (server )
505
+
506
+ mux .HandleFunc ("/api/v4/groups/1/issues" , func (w http.ResponseWriter , r * http.Request ) {
507
+ testMethod (t , r , http .MethodGet )
508
+ testURL (t , r , "/api/v4/groups/1/issues?iteration_id=90" )
509
+ fmt .Fprint (w , `
510
+ [
511
+ {
512
+ "id": 1,
513
+ "title": "A Test Issue Title",
514
+ "description": "This is the description for the issue",
515
+ "iteration": {
516
+ "id":90,
517
+ "iid":4,
518
+ "sequence":2,
519
+ "group_id":162,
520
+ "state":2,
521
+ "web_url":"https://gitlab.com/groups/my-group/-/iterations/90"
522
+ }
523
+ }
524
+ ]` ,
525
+ )
526
+ })
527
+
528
+ listProjectIssue := & ListGroupIssuesOptions {
529
+ IterationID : Int (90 ),
530
+ }
531
+
532
+ issues , _ , err := client .Issues .ListGroupIssues (1 , listProjectIssue )
533
+
534
+ if err != nil {
535
+ log .Fatal (err )
536
+ }
537
+
538
+ want := []* Issue {{
539
+ ID : 1 ,
540
+ Title : "A Test Issue Title" ,
541
+ Description : "This is the description for the issue" ,
542
+ Iteration : & GroupIteration {
543
+ ID : 90 ,
544
+ IID : 4 ,
545
+ Sequence : 2 ,
546
+ GroupID : 162 ,
547
+ State : 2 ,
548
+ WebURL : "https://gitlab.com/groups/my-group/-/iterations/90" ,
549
+ },
550
+ }}
551
+
552
+ if ! reflect .DeepEqual (want , issues ) {
553
+ t .Errorf ("Issues.ListIssues returned %+v, want %+v" , issues , want )
554
+ }
555
+ }
556
+
391
557
func TestCreateIssue (t * testing.T ) {
392
558
mux , server , client := setup (t )
393
559
defer teardown (server )
0 commit comments