@@ -119,3 +119,44 @@ func TestEnterpriseService_RemoveRunner(t *testing.T) {
119119 return client .Enterprise .RemoveRunner (ctx , "o" , 21 )
120120 })
121121}
122+
123+ func TestEnterpriseService_ListRunnerApplicationDownloads (t * testing.T ) {
124+ client , mux , _ , teardown := setup ()
125+ defer teardown ()
126+
127+ mux .HandleFunc ("/enterprises/o/actions/runners/downloads" , func (w http.ResponseWriter , r * http.Request ) {
128+ testMethod (t , r , "GET" )
129+ fmt .Fprint (w , `[{"os":"osx","architecture":"x64","download_url":"https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz","filename":"actions-runner-osx-x64-2.164.0.tar.gz"},{"os":"linux","architecture":"x64","download_url":"https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz","filename":"actions-runner-linux-x64-2.164.0.tar.gz"},{"os": "linux","architecture":"arm","download_url":"https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz","filename":"actions-runner-linux-arm-2.164.0.tar.gz"},{"os":"win","architecture":"x64","download_url":"https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip","filename":"actions-runner-win-x64-2.164.0.zip"},{"os":"linux","architecture":"arm64","download_url":"https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz","filename":"actions-runner-linux-arm64-2.164.0.tar.gz"}]` )
130+ })
131+
132+ ctx := context .Background ()
133+ downloads , _ , err := client .Enterprise .ListRunnerApplicationDownloads (ctx , "o" )
134+ if err != nil {
135+ t .Errorf ("Enterprise.ListRunnerApplicationDownloads returned error: %v" , err )
136+ }
137+
138+ want := []* RunnerApplicationDownload {
139+ {OS : String ("osx" ), Architecture : String ("x64" ), DownloadURL : String ("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-osx-x64-2.164.0.tar.gz" ), Filename : String ("actions-runner-osx-x64-2.164.0.tar.gz" )},
140+ {OS : String ("linux" ), Architecture : String ("x64" ), DownloadURL : String ("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-x64-2.164.0.tar.gz" ), Filename : String ("actions-runner-linux-x64-2.164.0.tar.gz" )},
141+ {OS : String ("linux" ), Architecture : String ("arm" ), DownloadURL : String ("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm-2.164.0.tar.gz" ), Filename : String ("actions-runner-linux-arm-2.164.0.tar.gz" )},
142+ {OS : String ("win" ), Architecture : String ("x64" ), DownloadURL : String ("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-win-x64-2.164.0.zip" ), Filename : String ("actions-runner-win-x64-2.164.0.zip" )},
143+ {OS : String ("linux" ), Architecture : String ("arm64" ), DownloadURL : String ("https://github.com/actions/runner/releases/download/v2.164.0/actions-runner-linux-arm64-2.164.0.tar.gz" ), Filename : String ("actions-runner-linux-arm64-2.164.0.tar.gz" )},
144+ }
145+ if ! cmp .Equal (downloads , want ) {
146+ t .Errorf ("Enterprise.ListRunnerApplicationDownloads returned %+v, want %+v" , downloads , want )
147+ }
148+
149+ const methodName = "ListRunnerApplicationDownloads"
150+ testBadOptions (t , methodName , func () (err error ) {
151+ _ , _ , err = client .Enterprise .ListRunnerApplicationDownloads (ctx , "\n " )
152+ return err
153+ })
154+
155+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
156+ got , resp , err := client .Enterprise .ListRunnerApplicationDownloads (ctx , "o" )
157+ if got != nil {
158+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
159+ }
160+ return resp , err
161+ })
162+ }
0 commit comments