(t *testing.T)
| 396 | } |
| 397 | |
| 398 | func 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 |
| 451 | func TestApplyGroupDifference(t *testing.T) { |
nothing calls this directly
no test coverage detected