(t *testing.T)
| 771 | } |
| 772 | |
| 773 | func Test_setRun_shouldNotStore(t *testing.T) { |
| 774 | reg := &httpmock.Registry{} |
| 775 | defer reg.Verify(t) |
| 776 | |
| 777 | reg.Register(httpmock.REST("GET", "repos/owner/repo/actions/secrets/public-key"), |
| 778 | httpmock.JSONResponse(PubKey{ID: "123", Key: "CDjXqf7AJBXWhMczcy+Fs7JlACEptgceysutztHaFQI="})) |
| 779 | |
| 780 | ios, _, stdout, stderr := iostreams.Test() |
| 781 | |
| 782 | opts := &SetOptions{ |
| 783 | HttpClient: func() (*http.Client, error) { |
| 784 | return &http.Client{Transport: reg}, nil |
| 785 | }, |
| 786 | Config: func() (gh.Config, error) { |
| 787 | return config.NewBlankConfig(), nil |
| 788 | }, |
| 789 | BaseRepo: func() (ghrepo.Interface, error) { |
| 790 | return ghrepo.FromFullName("owner/repo") |
| 791 | }, |
| 792 | IO: ios, |
| 793 | Body: "a secret", |
| 794 | DoNotStore: true, |
| 795 | RandomOverride: fakeRandom, |
| 796 | } |
| 797 | |
| 798 | err := setRun(opts) |
| 799 | assert.NoError(t, err) |
| 800 | |
| 801 | assert.Equal(t, "UKYUCbHd0DJemxa3AOcZ6XcsBwALG9d4bpB8ZT0gSV39vl3BHiGSgj8zJapDxgB2BwqNqRhpjC4=\n", stdout.String()) |
| 802 | assert.Equal(t, "", stderr.String()) |
| 803 | } |
| 804 | |
| 805 | func Test_getBody(t *testing.T) { |
| 806 | tests := []struct { |
nothing calls this directly
no test coverage detected