(t *testing.T)
| 364 | } |
| 365 | |
| 366 | func TestAuthGetUniqueRecord(t *testing.T) { |
| 367 | uid, authLvl, secret, expires, err := adp.AuthGetUniqueRecord("basic:alice") |
| 368 | if err != nil { |
| 369 | t.Fatal(err) |
| 370 | } |
| 371 | if uid != types.ParseUserId("usr"+testData.Recs[0].UserId) || |
| 372 | authLvl != testData.Recs[0].AuthLvl || |
| 373 | !reflect.DeepEqual(secret, testData.Recs[0].Secret) || |
| 374 | expires != testData.Recs[0].Expires { |
| 375 | |
| 376 | got := fmt.Sprintf("%v %v %v %v", uid, authLvl, secret, expires) |
| 377 | want := fmt.Sprintf("%v %v %v %v", testData.Recs[0].UserId, testData.Recs[0].AuthLvl, testData.Recs[0].Secret, testData.Recs[0].Expires) |
| 378 | t.Error(mismatchErrorString("Auth record", got, want)) |
| 379 | } |
| 380 | |
| 381 | // Test not found |
| 382 | uid, _, _, _, err = adp.AuthGetUniqueRecord("qwert:asdfg") |
| 383 | if err == nil && !uid.IsZero() { |
| 384 | t.Error("Auth record found but shouldn't. Uid:", uid.String()) |
| 385 | } |
| 386 | } |
| 387 | |
| 388 | func TestAuthGetRecord(t *testing.T) { |
| 389 | recId, authLvl, secret, expires, err := adp.AuthGetRecord(types.ParseUserId("usr"+testData.Recs[0].UserId), "basic") |
nothing calls this directly
no test coverage detected
searching dependent graphs…