@@ -415,3 +415,79 @@ func TestActionsService_EditDefaultWorkflowPermissionsInOrganization(t *testing.
415415 return resp , err
416416 })
417417}
418+
419+ func TestActionsService_GetArtifactAndLogRetentionPeriodInOrganization (t * testing.T ) {
420+ t .Parallel ()
421+ client , mux , _ := setup (t )
422+
423+ mux .HandleFunc ("/organizations/o/actions/permissions/artifact-and-log-retention" , func (w http.ResponseWriter , r * http.Request ) {
424+ testMethod (t , r , "GET" )
425+ fmt .Fprint (w , `{"days": 90, "maximum_allowed_days": 365}` )
426+ })
427+
428+ ctx := context .Background ()
429+ period , _ , err := client .Actions .GetArtifactAndLogRetentionPeriodInOrganization (ctx , "o" )
430+ if err != nil {
431+ t .Errorf ("Actions.GetArtifactAndLogRetentionPeriodInOrganization returned error: %v" , err )
432+ }
433+
434+ want := & ArtifactPeriod {
435+ Days : Ptr (90 ),
436+ MaximumAllowedDays : Ptr (365 ),
437+ }
438+ if ! cmp .Equal (period , want ) {
439+ t .Errorf ("Actions.GetArtifactAndLogRetentionPeriodInOrganization = %+v, want %+v" , period , want )
440+ }
441+
442+ const methodName = "GetArtifactAndLogRetentionPeriodInOrganization"
443+ testBadOptions (t , methodName , func () (err error ) {
444+ _ , _ , err = client .Actions .GetArtifactAndLogRetentionPeriodInOrganization (ctx , "\n " )
445+ return err
446+ })
447+
448+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
449+ got , resp , err := client .Actions .GetArtifactAndLogRetentionPeriodInOrganization (ctx , "o" )
450+ if got != nil {
451+ t .Errorf ("testNewRequestAndDoFailure %v = %#v, want nil" , methodName , got )
452+ }
453+ return resp , err
454+ })
455+ }
456+
457+ func TestActionsService_EditArtifactAndLogRetentionPeriodInOrganization (t * testing.T ) {
458+ t .Parallel ()
459+ client , mux , _ := setup (t )
460+
461+ input := & ArtifactPeriodOpt {Days : Ptr (90 )}
462+
463+ mux .HandleFunc ("/organizations/o/actions/permissions/artifact-and-log-retention" , func (w http.ResponseWriter , r * http.Request ) {
464+ v := new (ArtifactPeriodOpt )
465+ assertNilError (t , json .NewDecoder (r .Body ).Decode (v ))
466+
467+ testMethod (t , r , "PUT" )
468+ if ! cmp .Equal (v , input ) {
469+ t .Errorf ("Request body = %+v, want %+v" , v , input )
470+ }
471+ w .WriteHeader (http .StatusNoContent )
472+ })
473+
474+ ctx := context .Background ()
475+ resp , err := client .Actions .EditArtifactAndLogRetentionPeriodInOrganization (ctx , "o" , * input )
476+ if err != nil {
477+ t .Errorf ("Actions.EditArtifactAndLogRetentionPeriodInOrganization returned error: %v" , err )
478+ }
479+
480+ if resp .StatusCode != http .StatusNoContent {
481+ t .Errorf ("Actions.EditArtifactAndLogRetentionPeriodInOrganization = %d, want %d" , resp .StatusCode , http .StatusNoContent )
482+ }
483+
484+ const methodName = "EditArtifactAndLogRetentionPeriodInOrganization"
485+ testBadOptions (t , methodName , func () (err error ) {
486+ _ , err = client .Actions .EditArtifactAndLogRetentionPeriodInOrganization (ctx , "\n " , * input )
487+ return err
488+ })
489+
490+ testNewRequestAndDoFailure (t , methodName , client , func () (* Response , error ) {
491+ return client .Actions .EditArtifactAndLogRetentionPeriodInOrganization (ctx , "o" , * input )
492+ })
493+ }
0 commit comments