Fix TestRequestLogAPI

This commit is contained in:
Mike Schwörer 2024-07-17 13:39:44 +02:00
parent 1971b07d39
commit be05bfadec
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 3 additions and 4 deletions

View File

@ -130,20 +130,19 @@ func TestRequestLogAPI(t *testing.T) {
defer stop()
data := tt.InitDefaultData(t, ws)
time.Sleep(100 * time.Millisecond)
time.Sleep(900 * time.Millisecond)
ctx := ws.NewSimpleTransactionContext(5 * time.Second)
defer ctx.Cancel()
rl1, _, err := ws.Database.Requests.ListRequestLogs(ctx, models.RequestLogFilter{}, nil, ct.Start())
tt.TestFailIfErr(t, err)
time.Sleep(100 * time.Millisecond)
tt.RequestAuthGet[gin.H](t, data.User[0].ReadKey, baseUrl, "/api/v2/users/"+data.User[0].UID)
time.Sleep(900 * time.Millisecond)
rl2, _, err := ws.Database.Requests.ListRequestLogs(ctx, models.RequestLogFilter{}, nil, ct.Start())
tt.TestFailIfErr(t, err)
time.Sleep(100 * time.Millisecond)
tt.AssertEqual(t, "requestlog.count", len(rl1)+1, len(rl2))
}

View File

@ -42,7 +42,7 @@ func TestResponseClient(t *testing.T) {
data := tt.InitDefaultData(t, ws)
response := tt.RequestAuthGetRaw(t, data.User[0].AdminKey, baseUrl, fmt.Sprintf("/api/v2/users/%s/clients/%s", data.User[0].UID, data.User[0].Clients[0]))
response := tt.RequestAuthGetRaw(t, data.User[0].AdminKey, baseUrl, fmt.Sprintf("/api/v2/users/%s/clients/%s", data.User[2].UID, data.User[2].Clients[2]))
tt.AssertJsonStructureMatch(t, "json[client]", response, map[string]any{})
}