(t *testing.T)
| 12055 | } |
| 12056 | |
| 12057 | func TestChatDesktopEnabled(t *testing.T) { |
| 12058 | t.Parallel() |
| 12059 | |
| 12060 | t.Run("ReturnsFalseWhenUnset", func(t *testing.T) { |
| 12061 | t.Parallel() |
| 12062 | ctx := testutil.Context(t, testutil.WaitLong) |
| 12063 | |
| 12064 | adminClient := newChatClient(t) |
| 12065 | coderdtest.CreateFirstUser(t, adminClient.Client) |
| 12066 | |
| 12067 | resp, err := adminClient.GetChatDesktopEnabled(ctx) |
| 12068 | require.NoError(t, err) |
| 12069 | require.False(t, resp.EnableDesktop) |
| 12070 | }) |
| 12071 | |
| 12072 | t.Run("AdminCanSetTrue", func(t *testing.T) { |
| 12073 | t.Parallel() |
| 12074 | ctx := testutil.Context(t, testutil.WaitLong) |
| 12075 | |
| 12076 | adminClient := newChatClient(t) |
| 12077 | coderdtest.CreateFirstUser(t, adminClient.Client) |
| 12078 | |
| 12079 | err := adminClient.UpdateChatDesktopEnabled(ctx, codersdk.UpdateChatDesktopEnabledRequest{ |
| 12080 | EnableDesktop: true, |
| 12081 | }) |
| 12082 | require.NoError(t, err) |
| 12083 | |
| 12084 | resp, err := adminClient.GetChatDesktopEnabled(ctx) |
| 12085 | require.NoError(t, err) |
| 12086 | require.True(t, resp.EnableDesktop) |
| 12087 | }) |
| 12088 | |
| 12089 | t.Run("AdminCanSetFalse", func(t *testing.T) { |
| 12090 | t.Parallel() |
| 12091 | ctx := testutil.Context(t, testutil.WaitLong) |
| 12092 | |
| 12093 | adminClient := newChatClient(t) |
| 12094 | coderdtest.CreateFirstUser(t, adminClient.Client) |
| 12095 | |
| 12096 | // Set true first, then set false. |
| 12097 | err := adminClient.UpdateChatDesktopEnabled(ctx, codersdk.UpdateChatDesktopEnabledRequest{ |
| 12098 | EnableDesktop: true, |
| 12099 | }) |
| 12100 | require.NoError(t, err) |
| 12101 | |
| 12102 | err = adminClient.UpdateChatDesktopEnabled(ctx, codersdk.UpdateChatDesktopEnabledRequest{ |
| 12103 | EnableDesktop: false, |
| 12104 | }) |
| 12105 | require.NoError(t, err) |
| 12106 | |
| 12107 | resp, err := adminClient.GetChatDesktopEnabled(ctx) |
| 12108 | require.NoError(t, err) |
| 12109 | require.False(t, resp.EnableDesktop) |
| 12110 | }) |
| 12111 | |
| 12112 | t.Run("NonAdminCanRead", func(t *testing.T) { |
| 12113 | t.Parallel() |
| 12114 | ctx := testutil.Context(t, testutil.WaitLong) |
nothing calls this directly
no test coverage detected