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

Function Test_getBodyPrompt

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

Source from the content-addressed store, hash-verified

847}
848
849func Test_getBodyPrompt(t *testing.T) {
850 ios, _, _, _ := iostreams.Test()
851 ios.SetStdinTTY(true)
852 ios.SetStdoutTTY(true)
853
854 pm := prompter.NewMockPrompter(t)
855 pm.RegisterPassword("Paste your secret:", func(_ string) (string, error) {
856 return "cool secret", nil
857 })
858
859 body, err := getBody(&SetOptions{
860 IO: ios,
861 Prompter: pm,
862 })
863 assert.NoError(t, err)
864 assert.Equal(t, string(body), "cool secret")
865}
866
867func Test_getSecretsFromOptions(t *testing.T) {
868 genFile := func(s string) string {

Callers

nothing calls this directly

Calls 6

TestFunction · 0.92
NewMockPrompterFunction · 0.92
SetStdinTTYMethod · 0.80
SetStdoutTTYMethod · 0.80
EqualMethod · 0.80
getBodyFunction · 0.70

Tested by

no test coverage detected