MCPcopy Index your code
hub / github.com/coder/coder / TestReadInvocationStdin

Function TestReadInvocationStdin

cli/secret_internal_test.go:39–63  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestReadInvocationStdin(t *testing.T) {
40 t.Parallel()
41
42 t.Run("ZeroBytesRead", func(t *testing.T) {
43 t.Parallel()
44
45 inv := newSecretTestInvocation(t, strings.NewReader(""), nil)
46
47 got, provided, err := readInvocationStdin(inv)
48 require.NoError(t, err)
49 require.False(t, provided)
50 require.Empty(t, got)
51 })
52
53 t.Run("StringRead", func(t *testing.T) {
54 t.Parallel()
55
56 inv := newSecretTestInvocation(t, strings.NewReader("token"), nil)
57
58 got, provided, err := readInvocationStdin(inv)
59 require.NoError(t, err)
60 require.True(t, provided)
61 require.Equal(t, "token", got)
62 })
63}
64
65func TestTrailingNewlineWarnings(t *testing.T) {
66 t.Parallel()

Callers

nothing calls this directly

Calls 5

newSecretTestInvocationFunction · 0.85
readInvocationStdinFunction · 0.85
RunMethod · 0.65
EmptyMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected