MCPcopy
hub / github.com/gliderlabs/ssh / TestSetValue

Function TestSetValue

context_test.go:29–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestSetValue(t *testing.T) {
30 t.Parallel()
31 value := map[string]string{
32 "foo": "bar",
33 }
34 key := "testValue"
35 session, _, cleanup := newTestSessionWithOptions(t, &Server{
36 Handler: func(s Session) {
37 v := s.Context().Value(key).(map[string]string)
38 if v["foo"] != value["foo"] {
39 t.Fatalf("got %#v; want %#v", v, value)
40 }
41 },
42 }, nil, PasswordAuth(func(ctx Context, password string) bool {
43 ctx.SetValue(key, value)
44 return true
45 }))
46 defer cleanup()
47 if err := session.Run(""); err != nil {
48 t.Fatal(err)
49 }
50}
51
52func TestSetValueConcurrency(t *testing.T) {
53 ctx, cancel := newContext(nil)

Callers

nothing calls this directly

Calls 5

PasswordAuthFunction · 0.85
ValueMethod · 0.80
ContextMethod · 0.65
SetValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…