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

Function TestUserGetAll

server/db/postgres/tests/postgres_test.go:280–304  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

278}
279
280func TestUserGetAll(t *testing.T) {
281 // Test not found (dummy UIDs).
282 got, err := adp.UserGetAll(dummyUid1, dummyUid2)
283 if err != nil {
284 t.Fatal(err)
285 }
286 if len(got) > 0 {
287 t.Error("result users should be zero length, got", len(got))
288 }
289
290 got, err = adp.UserGetAll(types.ParseUserId("usr"+testData.Users[0].Id), types.ParseUserId("usr"+testData.Users[1].Id))
291 if err != nil {
292 t.Fatal(err)
293 }
294 if len(got) != 2 {
295 t.Fatal(mismatchErrorString("resultUsers length", len(got), 2))
296 }
297 for i, usr := range got {
298 // User agent is not compared.
299 usr.UserAgent = testData.Users[i].UserAgent
300 if !reflect.DeepEqual(&usr, testData.Users[i]) {
301 t.Error(mismatchErrorString("User", &usr, testData.Users[i]))
302 }
303 }
304}
305
306func TestUserGetByCred(t *testing.T) {
307 // Test not found

Callers

nothing calls this directly

Calls 4

ParseUserIdFunction · 0.92
ErrorMethod · 0.80
mismatchErrorStringFunction · 0.70
UserGetAllMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…