| 1075 | } |
| 1076 | |
| 1077 | func Group(t testing.TB, db database.Store, orig database.Group) database.Group { |
| 1078 | t.Helper() |
| 1079 | |
| 1080 | name := takeFirst(orig.Name, testutil.GetRandomName(t)) |
| 1081 | group, err := db.InsertGroup(genCtx, database.InsertGroupParams{ |
| 1082 | ID: takeFirst(orig.ID, uuid.New()), |
| 1083 | Name: name, |
| 1084 | DisplayName: takeFirst(orig.DisplayName, name), |
| 1085 | OrganizationID: takeFirst(orig.OrganizationID, uuid.New()), |
| 1086 | AvatarURL: takeFirst(orig.AvatarURL, "https://logo.example.com"), |
| 1087 | QuotaAllowance: takeFirst(orig.QuotaAllowance, 0), |
| 1088 | }) |
| 1089 | require.NoError(t, err, "insert group") |
| 1090 | return group |
| 1091 | } |
| 1092 | |
| 1093 | // GroupMember requires a user + group to already exist. |
| 1094 | // Example for creating a group member for a random group + user. |