MCPcopy
hub / github.com/purpleidea/mgmt / TestUserCheckApply_AbsentAlready

Function TestUserCheckApply_AbsentAlready

engine/resources/user_test.go:264–285  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

262}
263
264func TestUserCheckApply_AbsentAlready(t *testing.T) {
265 f := &fakeUserFuncs{}
266 f.install(t)
267
268 res := &UserRes{State: "absent"}
269 res.SetName("ghost")
270 res.SetKind("user")
271 if err := res.Init(fakeUserInit(t)); err != nil {
272 t.Fatal(err)
273 }
274
275 checkOK, err := res.CheckApply(context.Background(), true)
276 if err != nil {
277 t.Fatalf("func CheckApply: %v", err)
278 }
279 if !checkOK {
280 t.Errorf("expected checkOK=true for already-absent user")
281 }
282 if len(f.cmds) != 0 {
283 t.Errorf("expected no commands, got %v", f.cmds)
284 }
285}
286
287func TestUserCheckApply_CreateNoApply(t *testing.T) {
288 f := &fakeUserFuncs{}

Callers

nothing calls this directly

Calls 7

installMethod · 0.95
InitMethod · 0.95
CheckApplyMethod · 0.95
fakeUserInitFunction · 0.85
SetNameMethod · 0.65
SetKindMethod · 0.65
BackgroundMethod · 0.65

Tested by

no test coverage detected