github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/teams/tar_test.go (about)

     1  package teams
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/keybase/client/go/kbtest"
     7  	"github.com/stretchr/testify/require"
     8  	"golang.org/x/net/context"
     9  )
    10  
    11  func TestSetTarsDisabled(t *testing.T) {
    12  	tc := SetupTest(t, "team", 1)
    13  	defer tc.Cleanup()
    14  
    15  	_, err := kbtest.CreateAndSignupFakeUser("team", tc.G)
    16  	require.NoError(t, err)
    17  
    18  	notifications := kbtest.NewTeamNotifyListener()
    19  	tc.G.SetService()
    20  	tc.G.NotifyRouter.AddListener(notifications)
    21  
    22  	name, id := createTeam2(tc)
    23  	t.Logf("Created team %q", name)
    24  
    25  	disabled, err := GetTarsDisabled(context.Background(), tc.G, id)
    26  	require.NoError(t, err)
    27  	require.False(t, disabled)
    28  
    29  	err = SetTarsDisabled(context.Background(), tc.G, id, true)
    30  	require.NoError(t, err)
    31  	kbtest.CheckTeamMiscNotifications(tc, notifications)
    32  
    33  	disabled, err = GetTarsDisabled(context.Background(), tc.G, id)
    34  	require.NoError(t, err)
    35  	require.True(t, disabled)
    36  }