(t *testing.T)
| 373 | } |
| 374 | |
| 375 | func TestUserCheckApply_Delete(t *testing.T) { |
| 376 | f := &fakeUserFuncs{} |
| 377 | f.addUser(newTestUser("james", 1000, 1000, "/home/james/"), nil, "/bin/bash") |
| 378 | f.install(t) |
| 379 | |
| 380 | res := &UserRes{State: "absent"} |
| 381 | res.SetName("james") |
| 382 | res.SetKind("user") |
| 383 | if err := res.Init(fakeUserInit(t)); err != nil { |
| 384 | t.Fatal(err) |
| 385 | } |
| 386 | |
| 387 | checkOK, err := res.CheckApply(context.Background(), true) |
| 388 | if err != nil { |
| 389 | t.Fatalf("func CheckApply: %v", err) |
| 390 | } |
| 391 | if checkOK { |
| 392 | t.Errorf("expected checkOK=false on delete") |
| 393 | } |
| 394 | want := fakeUserCmd{Name: "userdel", Args: []string{"james"}} |
| 395 | if len(f.cmds) != 1 || !reflect.DeepEqual(f.cmds[0], want) { |
| 396 | t.Errorf("expected userdel james, got %v", f.cmds) |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | func TestUserCheckApply_UIDConflict(t *testing.T) { |
| 401 | f := &fakeUserFuncs{} |
nothing calls this directly
no test coverage detected