mirror of
https://github.com/coder/coder.git
synced 2025-07-03 16:13:58 +00:00
feat: audit log api (#3898)
This commit is contained in:
35
coderd/audit_test.go
Normal file
35
coderd/audit_test.go
Normal file
@ -0,0 +1,35 @@
|
||||
package coderd_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/coder/coder/coderd/coderdtest"
|
||||
"github.com/coder/coder/codersdk"
|
||||
)
|
||||
|
||||
func TestAuditLogs(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
t.Run("OK", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
ctx := context.Background()
|
||||
client := coderdtest.New(t, nil)
|
||||
_ = coderdtest.CreateFirstUser(t, client)
|
||||
|
||||
err := client.CreateTestAuditLog(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
count, err := client.AuditLogCount(ctx)
|
||||
require.NoError(t, err)
|
||||
|
||||
alogs, err := client.AuditLogs(ctx, codersdk.Pagination{Limit: 1})
|
||||
require.NoError(t, err)
|
||||
|
||||
require.Equal(t, int64(1), count.Count)
|
||||
require.Len(t, alogs.AuditLogs, 1)
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user