MCPcopy Index your code
hub / github.com/cli/cli / Test_setRun_shouldNotStore

Function Test_setRun_shouldNotStore

pkg/cmd/secret/set/set_test.go:773–803  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

771}
772
773func 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
805func Test_getBody(t *testing.T) {
806 tests := []struct {

Callers

nothing calls this directly

Calls 10

VerifyMethod · 0.95
RegisterMethod · 0.95
RESTFunction · 0.92
JSONResponseFunction · 0.92
TestFunction · 0.92
NewBlankConfigFunction · 0.92
FromFullNameFunction · 0.92
EqualMethod · 0.80
setRunFunction · 0.70
StringMethod · 0.45

Tested by

no test coverage detected