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

Function TestAuthGetRecord

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

Source from the content-addressed store, hash-verified

386}
387
388func TestAuthGetRecord(t *testing.T) {
389 recId, authLvl, secret, expires, err := adp.AuthGetRecord(types.ParseUserId("usr"+testData.Recs[0].UserId), "basic")
390 if err != nil {
391 t.Fatal(err)
392 }
393 if recId != testData.Recs[0].Unique ||
394 authLvl != testData.Recs[0].AuthLvl ||
395 !reflect.DeepEqual(secret, testData.Recs[0].Secret) ||
396 expires != testData.Recs[0].Expires {
397
398 got := fmt.Sprintf("%v %v %v %v", recId, authLvl, secret, expires)
399 want := fmt.Sprintf("%v %v %v %v", testData.Recs[0].Unique, testData.Recs[0].AuthLvl, testData.Recs[0].Secret, testData.Recs[0].Expires)
400 t.Error(mismatchErrorString("Auth record", got, want))
401 }
402
403 // Test not found
404 recId, _, _, _, err = adp.AuthGetRecord(types.Uid(123), "scheme")
405 if err != types.ErrNotFound {
406 t.Error("Auth record found but shouldn't. recId:", recId)
407 }
408}
409
410func TestTopicGet(t *testing.T) {
411 got, err := adp.TopicGet(testData.Topics[0].Id)

Callers

nothing calls this directly

Calls 5

ParseUserIdFunction · 0.92
UidTypeAlias · 0.92
ErrorMethod · 0.80
mismatchErrorStringFunction · 0.70
AuthGetRecordMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…