MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / TestPTYRequest

Function TestPTYRequest

internal/security/handler_session_test.go:46–64  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

44}
45
46func TestPTYRequest(t *testing.T) {
47 session := &sessionHandler{
48 config: config.SecurityConfig{},
49 backend: &dummyBackend{},
50 sshConnection: &sshConnectionHandler{
51 lock: &sync.Mutex{},
52 },
53 logger: log.NewTestLogger(t),
54 }
55
56 session.config.TTY.Mode = config.ExecutionPolicyEnable
57 assert.NoError(t, session.OnPtyRequest(1, "XTERM", 80, 25, 800, 600, []byte{}))
58
59 session.config.TTY.Mode = config.ExecutionPolicyFilter
60 assert.Error(t, session.OnPtyRequest(1, "XTERM", 80, 25, 800, 600, []byte{}))
61
62 session.config.TTY.Mode = config.ExecutionPolicyDisable
63 assert.Error(t, session.OnPtyRequest(1, "XTERM", 80, 25, 800, 600, []byte{}))
64}
65
66func TestCommand(t *testing.T) {
67 backend := &dummyBackend{}

Callers

nothing calls this directly

Calls 3

OnPtyRequestMethod · 0.95
NewTestLoggerFunction · 0.92
ErrorMethod · 0.65

Tested by

no test coverage detected