MCPcopy Index your code
hub / github.com/coder/coder / TestApplyGroupDifference

Function TestApplyGroupDifference

coderd/idpsync/group_test.go:451–599  ·  view source on GitHub ↗

TestApplyGroupDifference is mainly testing the database functions

(t *testing.T)

Source from the content-addressed store, hash-verified

449
450// TestApplyGroupDifference is mainly testing the database functions
451func TestApplyGroupDifference(t *testing.T) {
452 t.Parallel()
453
454 ids := coderdtest.NewDeterministicUUIDGenerator()
455 testCase := []struct {
456 Name string
457 Before map[uuid.UUID]bool
458 Add []uuid.UUID
459 Remove []uuid.UUID
460 Expect []uuid.UUID
461 }{
462 {
463 Name: "Empty",
464 },
465 {
466 Name: "AddFromNone",
467 Before: map[uuid.UUID]bool{
468 ids.ID("g1"): false,
469 },
470 Add: []uuid.UUID{
471 ids.ID("g1"),
472 },
473 Expect: []uuid.UUID{
474 ids.ID("g1"),
475 },
476 },
477 {
478 Name: "AddSome",
479 Before: map[uuid.UUID]bool{
480 ids.ID("g1"): true,
481 ids.ID("g2"): false,
482 ids.ID("g3"): false,
483 uuid.New(): false,
484 },
485 Add: []uuid.UUID{
486 ids.ID("g2"),
487 ids.ID("g3"),
488 },
489 Expect: []uuid.UUID{
490 ids.ID("g1"),
491 ids.ID("g2"),
492 ids.ID("g3"),
493 },
494 },
495 {
496 Name: "RemoveAll",
497 Before: map[uuid.UUID]bool{
498 uuid.New(): false,
499 ids.ID("g2"): true,
500 ids.ID("g3"): true,
501 },
502 Remove: []uuid.UUID{
503 ids.ID("g2"),
504 ids.ID("g3"),
505 },
506 Expect: []uuid.UUID{},
507 },
508 {

Callers

nothing calls this directly

Calls 15

IDMethod · 0.95
NewManagerFunction · 0.92
NewDBFunction · 0.92
ContextFunction · 0.92
OrganizationFunction · 0.92
UserFunction · 0.92
OrganizationMemberFunction · 0.92
GroupFunction · 0.92
GroupMemberFunction · 0.92
NewAGPLSyncFunction · 0.92
FromDeploymentValuesFunction · 0.92

Tested by

no test coverage detected