MCPcopy Create free account
hub / github.com/astercloud/aster / TestAccessController_UpdateUser

Function TestAccessController_UpdateUser

pkg/security/access_control_test.go:363–387  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

361}
362
363func TestAccessController_UpdateUser(t *testing.T) {
364 ac := NewAccessController(&AccessControlConfig{}, &mockAuditLog{})
365
366 // 创建用户
367 user := &User{
368 ID: "user1",
369 Username: "testuser",
370 Email: "old@example.com",
371 Status: UserStatusActive,
372 }
373 _ = ac.CreateUser(user)
374
375 // 更新用户
376 user.Email = "new@example.com"
377 err := ac.UpdateUser(user)
378 if err != nil {
379 t.Fatalf("UpdateUser failed: %v", err)
380 }
381
382 // 验证更新
383 retrieved, _ := ac.GetUser("user1")
384 if retrieved.Email != "new@example.com" {
385 t.Errorf("expected email 'new@example.com', got '%s'", retrieved.Email)
386 }
387}
388
389func TestAccessController_ConcurrentAccess(t *testing.T) {
390 ac := NewAccessController(&AccessControlConfig{}, &mockAuditLog{})

Callers

nothing calls this directly

Calls 4

CreateUserMethod · 0.95
UpdateUserMethod · 0.95
GetUserMethod · 0.95
NewAccessControllerFunction · 0.85

Tested by

no test coverage detected