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

Function TestUserGet

server/db/postgres/tests/postgres_test.go:260–278  ·  view source on GitHub ↗

================== Read tests ==================================

(t *testing.T)

Source from the content-addressed store, hash-verified

258
259// ================== Read tests ==================================
260func TestUserGet(t *testing.T) {
261 // Test not found
262 got, err := adp.UserGet(dummyUid1)
263 if err == nil && got != nil {
264 t.Error("user should be nil.")
265 }
266
267 got, err = adp.UserGet(types.ParseUserId("usr" + testData.Users[0].Id))
268 if err != nil {
269 t.Fatal(err)
270 }
271
272 // User agent is not stored when creating a user. Make sure it's the same.
273 got.UserAgent = testData.Users[0].UserAgent
274
275 if !reflect.DeepEqual(got, testData.Users[0]) {
276 t.Error(mismatchErrorString("User", got, testData.Users[0]))
277 }
278}
279
280func TestUserGetAll(t *testing.T) {
281 // Test not found (dummy UIDs).

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…