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

Method Assert

coderd/idpsync/group_test.go:858–886  ·  view source on GitHub ↗
(t *testing.T, orgID uuid.UUID, db database.Store, user database.User)

Source from the content-addressed store, hash-verified

856}
857
858func (o orgSetupDefinition) Assert(t *testing.T, orgID uuid.UUID, db database.Store, user database.User) {
859 t.Helper()
860
861 ctx := context.Background()
862
863 members, err := db.OrganizationMembers(ctx, database.OrganizationMembersParams{
864 OrganizationID: orgID,
865 UserID: user.ID,
866 })
867 require.NoError(t, err)
868 if o.NotMember {
869 require.Len(t, members, 0, "should not be a member")
870 } else {
871 require.Len(t, members, 1, "should be a member")
872 }
873
874 if o.assertGroups != nil {
875 o.assertGroups.Assert(t, orgID, db, user)
876 }
877 if o.assertRoles != nil {
878 o.assertRoles.Assert(t, orgID, db, o.NotMember, user)
879 }
880
881 // If the user is not a member, there is nothing to really assert in the org
882 if o.assertGroups == nil && o.assertRoles == nil && !o.NotMember {
883 t.Errorf("no group or role asserts present, must have at least one")
884 t.FailNow()
885 }
886}
887
888func (o *orgGroupAssert) Assert(t *testing.T, orgID uuid.UUID, db database.Store, user database.User) {
889 t.Helper()

Callers 2

TestGroupSyncTableFunction · 0.95
TestSyncDisabledFunction · 0.95

Calls 6

FailNowMethod · 0.80
HelperMethod · 0.65
OrganizationMembersMethod · 0.65
LenMethod · 0.45
AssertMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected