nolint:revive // t takes precedence.
(t *testing.T, ctx context.Context, api *codersdk.Client, id uuid.UUID)
| 140 | |
| 141 | // nolint:revive // t takes precedence. |
| 142 | func getTemplateByID(t *testing.T, ctx context.Context, api *codersdk.Client, id uuid.UUID) (*codersdk.NotificationTemplate, error) { |
| 143 | t.Helper() |
| 144 | |
| 145 | var template codersdk.NotificationTemplate |
| 146 | templates, err := api.GetSystemNotificationTemplates(ctx) |
| 147 | if err != nil { |
| 148 | return nil, err |
| 149 | } |
| 150 | |
| 151 | for _, tmpl := range templates { |
| 152 | if tmpl.ID == id { |
| 153 | template = tmpl |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | if template.ID == uuid.Nil { |
| 158 | return nil, xerrors.Errorf("template not found: %q", id.String()) |
| 159 | } |
| 160 | |
| 161 | return &template, nil |
| 162 | } |
no test coverage detected