MCPcopy
hub / github.com/tinode/chat / TestDispatchInvalidVersion

Function TestDispatchInvalidVersion

server/session_test.go:98–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

96}
97
98func TestDispatchInvalidVersion(t *testing.T) {
99 s := &Session{
100 send: make(chan any, 10),
101 uid: types.Uid(1),
102 authLvl: auth.LevelAuth,
103 }
104 wg := sync.WaitGroup{}
105 r := responses{}
106 wg.Add(1)
107 go s.testWriteLoop(&r, &wg)
108 msg := &ClientComMessage{
109 Hi: &MsgClientHi{
110 Id: "123",
111 // Invalid version string.
112 Version: "INVALID VERSION STRING",
113 },
114 }
115 s.dispatch(msg)
116 close(s.send)
117 wg.Wait()
118 verifyResponseCodes(&r, []int{http.StatusBadRequest}, t)
119}
120
121func TestDispatchUnsupportedVersion(t *testing.T) {
122 s := &Session{

Callers

nothing calls this directly

Calls 6

testWriteLoopMethod · 0.95
dispatchMethod · 0.95
UidTypeAlias · 0.92
verifyResponseCodesFunction · 0.85
WaitMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…