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

Function TestSyncDisabled

coderd/idpsync/group_test.go:398–448  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

396}
397
398func TestSyncDisabled(t *testing.T) {
399 t.Parallel()
400
401 db, _ := dbtestutil.NewDB(t)
402 manager := runtimeconfig.NewManager()
403 s := idpsync.NewAGPLSync(slogtest.Make(t, &slogtest.Options{}),
404 manager,
405 idpsync.DeploymentSyncSettings{},
406 )
407
408 ids := coderdtest.NewDeterministicUUIDGenerator()
409 ctx := testutil.Context(t, testutil.WaitSuperLong)
410 user := dbgen.User(t, db, database.User{})
411 orgID := uuid.New()
412
413 def := orgSetupDefinition{
414 Name: "SyncDisabled",
415 Groups: map[uuid.UUID]bool{
416 ids.ID("foo"): true,
417 ids.ID("bar"): true,
418 ids.ID("baz"): false,
419 ids.ID("bop"): false,
420 },
421 GroupSettings: &codersdk.GroupSyncSettings{
422 Field: "groups",
423 Mapping: map[string][]uuid.UUID{
424 "foo": {ids.ID("foo")},
425 "baz": {ids.ID("baz")},
426 },
427 },
428 assertGroups: &orgGroupAssert{
429 ExpectedGroups: []uuid.UUID{
430 ids.ID("foo"),
431 ids.ID("bar"),
432 },
433 },
434 }
435
436 SetupOrganization(t, s, db, user, orgID, def)
437
438 // Do the group sync!
439 err := s.SyncGroups(ctx, db, user, idpsync.GroupParams{
440 SyncEntitled: false,
441 MergedClaims: jwt.MapClaims{
442 "groups": []string{"baz", "bop"},
443 },
444 })
445 require.NoError(t, err)
446
447 def.Assert(t, orgID, db, user)
448}
449
450// TestApplyGroupDifference is mainly testing the database functions
451func TestApplyGroupDifference(t *testing.T) {

Callers

nothing calls this directly

Calls 11

IDMethod · 0.95
AssertMethod · 0.95
NewDBFunction · 0.92
NewManagerFunction · 0.92
NewAGPLSyncFunction · 0.92
ContextFunction · 0.92
UserFunction · 0.92
SetupOrganizationFunction · 0.85
NewMethod · 0.65
SyncGroupsMethod · 0.65

Tested by

no test coverage detected