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

Function TestNotificationsTemplates

coderd/notifications/notifications_test.go:1996–2015  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1994}
1995
1996func 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
2017func createOpts(t *testing.T) *coderdtest.Options {
2018 t.Helper()

Callers

nothing calls this directly

Calls 8

AsNotifierFunction · 0.92
ContextFunction · 0.92
NewFunction · 0.92
CreateFirstUserFunction · 0.92
CreateAnotherUserFunction · 0.92
RoleMemberFunction · 0.92
createOptsFunction · 0.70

Tested by

no test coverage detected