@@ -620,14 +620,14 @@ func TestIssueService_DeleteLink(t *testing.T) {
620620func TestIssueService_Search (t * testing.T ) {
621621 setup ()
622622 defer teardown ()
623- testMux .HandleFunc ("/rest/api/2/search " , func (w http.ResponseWriter , r * http.Request ) {
623+ testMux .HandleFunc ("" , func (w http.ResponseWriter , r * http.Request ) {
624624 testMethod (t , r , http .MethodGet )
625- testRequestURL (t , r , "/rest/api/2 /search?expand=foo&jql=type+%3D+Bug+and+Status+NOT+IN+%28Resolved%29&maxResults=40&startAt=1" )
625+ testRequestURL (t , r , "/rest/api/3 /search/jql ?expand=foo&jql=type+%3D+Bug+and+Status+NOT+IN+%28Resolved%29&maxResults=40&startAt=1" )
626626 w .WriteHeader (http .StatusOK )
627- fmt .Fprint (w , `{"expand": "schema,names","startAt": 1," maxResults": 40,"total": 6 ,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
627+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 40,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
628628 })
629629
630- opt := & SearchOptions {StartAt : 1 , MaxResults : 40 , Expand : "foo" }
630+ opt := & SearchOptions {MaxResults : 40 }
631631 _ , resp , err := testClient .Issue .Search (context .Background (), "type = Bug and Status NOT IN (Resolved)" , opt )
632632
633633 if resp == nil {
@@ -651,14 +651,14 @@ func TestIssueService_Search(t *testing.T) {
651651func TestIssueService_SearchEmptyJQL (t * testing.T ) {
652652 setup ()
653653 defer teardown ()
654- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
654+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
655655 testMethod (t , r , http .MethodGet )
656- testRequestURL (t , r , "/rest/api/2 /search?expand=foo&maxResults=40&startAt=1" )
656+ testRequestURL (t , r , "/rest/api/3 /search/jql ?expand=foo&maxResults=40&startAt=1" )
657657 w .WriteHeader (http .StatusOK )
658- fmt .Fprint (w , `{"expand": "schema,names","startAt": 1," maxResults": 40,"total": 6 ,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
658+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 40,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
659659 })
660660
661- opt := & SearchOptions {StartAt : 1 , MaxResults : 40 , Expand : "foo" }
661+ opt := & SearchOptions {MaxResults : 40 }
662662 _ , resp , err := testClient .Issue .Search (context .Background (), "" , opt )
663663
664664 if resp == nil {
@@ -682,9 +682,9 @@ func TestIssueService_SearchEmptyJQL(t *testing.T) {
682682func TestIssueService_Search_WithoutPaging (t * testing.T ) {
683683 setup ()
684684 defer teardown ()
685- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
685+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
686686 testMethod (t , r , http .MethodGet )
687- testRequestURL (t , r , "/rest/api/2 /search?jql=something" )
687+ testRequestURL (t , r , "/rest/api/3 /search/jql ?jql=something" )
688688 w .WriteHeader (http .StatusOK )
689689 fmt .Fprint (w , `{"expand": "schema,names","startAt": 0,"maxResults": 50,"total": 6,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
690690 })
@@ -711,26 +711,26 @@ func TestIssueService_Search_WithoutPaging(t *testing.T) {
711711func TestIssueService_SearchPages (t * testing.T ) {
712712 setup ()
713713 defer teardown ()
714- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
714+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
715715 testMethod (t , r , http .MethodGet )
716- if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=2&startAt=1&validateQuery=warn" {
716+ if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=2&startAt=1&validateQuery=warn" {
717717 w .WriteHeader (http .StatusOK )
718718 fmt .Fprint (w , `{"expand": "schema,names","startAt": 1,"maxResults": 2,"total": 6,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
719719 return
720- } else if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=2&startAt=3&validateQuery=warn" {
720+ } else if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=2&startAt=3&validateQuery=warn" {
721721 w .WriteHeader (http .StatusOK )
722722 fmt .Fprint (w , `{"expand": "schema,names","startAt": 3,"maxResults": 2,"total": 6,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}},{"expand": "html","id": "10004","self": "http://kelpie9:8081/rest/api/2/issue/BULK-47","key": "BULK-47","fields": {"summary": "Cheese v1 2.0 issue","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/3","id": "3","description": "A task that needs to be done.","iconUrl": "http://kelpie9:8081/images/icons/task.gif","name": "Task","subtask": false}}}]}` )
723723 return
724- } else if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=2&startAt=5&validateQuery=warn" {
724+ } else if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=2&startAt=5&validateQuery=warn" {
725725 w .WriteHeader (http .StatusOK )
726- fmt .Fprint (w , `{"expand": "schema,names","startAt": 5," maxResults": 2,"total": 6 ,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}}]}` )
726+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 2,"issues": [{"expand": "html","id": "10230","self": "http://kelpie9:8081/rest/api/2/issue/BULK-62","key": "BULK-62","fields": {"summary": "testing","timetracking": null,"issuetype": {"self": "http://kelpie9:8081/rest/api/2/issuetype/5","id": "5","description": "The sub-task of the issue","iconUrl": "http://kelpie9:8081/images/icons/issue_subtask.gif","name": "Sub-task","subtask": true},"customfield_10071": null}}]}` )
727727 return
728728 }
729729
730730 t .Errorf ("Unexpected URL: %v" , r .URL )
731731 })
732732
733- opt := & SearchOptions {StartAt : 1 , MaxResults : 2 , Expand : "foo" , ValidateQuery : "warn" }
733+ opt := & SearchOptions {MaxResults : 2 }
734734 issues := make ([]Issue , 0 )
735735 err := testClient .Issue .SearchPages (context .Background (), "something" , opt , func (issue Issue ) error {
736736 issues = append (issues , issue )
@@ -749,19 +749,19 @@ func TestIssueService_SearchPages(t *testing.T) {
749749func TestIssueService_SearchPages_EmptyResult (t * testing.T ) {
750750 setup ()
751751 defer teardown ()
752- testMux .HandleFunc ("/rest/api/2 /search" , func (w http.ResponseWriter , r * http.Request ) {
752+ testMux .HandleFunc ("/rest/api/3 /search/jql " , func (w http.ResponseWriter , r * http.Request ) {
753753 testMethod (t , r , http .MethodGet )
754- if r .URL .String () == "/rest/api/2 /search?expand=foo&jql=something&maxResults=50&startAt=1&validateQuery=warn" {
754+ if r .URL .String () == "/rest/api/3 /search/jql ?expand=foo&jql=something&maxResults=50&startAt=1&validateQuery=warn" {
755755 w .WriteHeader (http .StatusOK )
756756 // This is what Jira outputs when the &maxResult= issue occurs. It used to cause SearchPages to go into an endless loop.
757- fmt .Fprint (w , `{"expand": "schema,names","startAt": 0," maxResults": 0,"total": 6 ,"issues": []}` )
757+ fmt .Fprint (w , `{"expand": "schema,names","maxResults": 0,"issues": []}` )
758758 return
759759 }
760760
761761 t .Errorf ("Unexpected URL: %v" , r .URL )
762762 })
763763
764- opt := & SearchOptions {StartAt : 1 , MaxResults : 50 , Expand : "foo" , ValidateQuery : "warn" }
764+ opt := & SearchOptions {MaxResults : 50 }
765765 issues := make ([]Issue , 0 )
766766 err := testClient .Issue .SearchPages (context .Background (), "something" , opt , func (issue Issue ) error {
767767 issues = append (issues , issue )
0 commit comments