(t *testing.T)
| 1994 | } |
| 1995 | |
| 1996 | func TestNotificationsTemplates(t *testing.T) { |
| 1997 | t.Parallel() |
| 1998 | |
| 1999 | ctx := dbauthz.AsNotifier(testutil.Context(t, testutil.WaitSuperLong)) |
| 2000 | api := coderdtest.New(t, createOpts(t)) |
| 2001 | |
| 2002 | // GIVEN: the first user (owner) and a regular member |
| 2003 | firstUser := coderdtest.CreateFirstUser(t, api) |
| 2004 | memberClient, _ := coderdtest.CreateAnotherUser(t, api, firstUser.OrganizationID, rbac.RoleMember()) |
| 2005 | |
| 2006 | // WHEN: requesting system notification templates as owner should work |
| 2007 | templates, err := api.GetSystemNotificationTemplates(ctx) |
| 2008 | require.NoError(t, err) |
| 2009 | require.True(t, len(templates) > 1) |
| 2010 | |
| 2011 | // WHEN: requesting system notification templates as member should work |
| 2012 | templates, err = memberClient.GetSystemNotificationTemplates(ctx) |
| 2013 | require.NoError(t, err) |
| 2014 | require.True(t, len(templates) > 1) |
| 2015 | } |
| 2016 | |
| 2017 | func createOpts(t *testing.T) *coderdtest.Options { |
| 2018 | t.Helper() |
nothing calls this directly
no test coverage detected