@@ -321,6 +321,34 @@ func TestRepositoriesService_DownloadContents_NoFile(t *testing.T) {
321321 }
322322}
323323
324+ func TestRepositoriesService_DownloadContents_NotFile (t * testing.T ) {
325+ t .Parallel ()
326+ client , mux , _ := setup (t )
327+
328+ mux .HandleFunc ("/repos/o/r/contents/d" , func (w http.ResponseWriter , r * http.Request ) {
329+ testMethod (t , r , "GET" )
330+ fmt .Fprint (w , `[{
331+ "type": "file",
332+ "name": "f",
333+ "content": ""
334+ }]` )
335+ })
336+
337+ ctx := t .Context ()
338+ reader , resp , err := client .Repositories .DownloadContents (ctx , "o" , "r" , "d" , nil )
339+ if err == nil {
340+ t .Error ("Repositories.DownloadContents did not return expected error" )
341+ }
342+
343+ if resp == nil {
344+ t .Error ("Repositories.DownloadContents did not return expected response" )
345+ }
346+
347+ if reader != nil {
348+ t .Error ("Repositories.DownloadContents did not return expected reader" )
349+ }
350+ }
351+
324352func TestRepositoriesService_DownloadContentsWithMeta_SuccessWithContent (t * testing.T ) {
325353 t .Parallel ()
326354 client , mux , serverURL := setup (t )
@@ -527,6 +555,30 @@ func TestRepositoriesService_DownloadContentsWithMeta_NoFile(t *testing.T) {
527555 }
528556}
529557
558+ func TestRepositoriesService_DownloadContentsWithMeta_NotFile (t * testing.T ) {
559+ t .Parallel ()
560+ client , mux , _ := setup (t )
561+
562+ mux .HandleFunc ("/repos/o/r/contents/d" , func (w http.ResponseWriter , r * http.Request ) {
563+ testMethod (t , r , "GET" )
564+ fmt .Fprint (w , `[{
565+ "type": "file",
566+ "name": "f",
567+ "content": ""
568+ }]` )
569+ })
570+
571+ ctx := t .Context ()
572+ _ , _ , resp , err := client .Repositories .DownloadContentsWithMeta (ctx , "o" , "r" , "d" , nil )
573+ if err == nil {
574+ t .Error ("Repositories.DownloadContentsWithMeta did not return expected error" )
575+ }
576+
577+ if resp == nil {
578+ t .Error ("Repositories.DownloadContentsWithMeta did not return expected response" )
579+ }
580+ }
581+
530582func TestRepositoriesService_GetContents_File (t * testing.T ) {
531583 t .Parallel ()
532584 client , mux , _ := setup (t )
0 commit comments