github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/teams/deleted_users_test.go (about) 1 package teams 2 3 import ( 4 "context" 5 "testing" 6 7 "github.com/keybase/client/go/kbtest" 8 keybase1 "github.com/keybase/client/go/protocol/keybase1" 9 "github.com/stretchr/testify/require" 10 ) 11 12 // This test is in teams package because masking deleted users' 13 // sigchain is tightly related to teams and implicit teams. Sigchain 14 // of a deleted user is only accessible to users who used to be team 15 // mates at any point in time prior to deletion, but only in current 16 // reset incarnation of requesting user. 17 18 func TestDeletedUser(t *testing.T) { 19 fus, tcs, cleanup := setupNTests(t, 3) 20 defer cleanup() 21 22 teamname := createTeam(*tcs[0]) 23 t.Logf("Created team %q", teamname) 24 25 // Add user 1 and user 2 to team. 26 require.NoError(t, SetRoleWriter(context.Background(), tcs[0].G, teamname, fus[1].Username)) 27 require.NoError(t, SetRoleWriter(context.Background(), tcs[0].G, teamname, fus[2].Username)) 28 29 // User 1 leaves the team (signs team link!) and deletes themself. 30 require.NoError(t, Leave(context.Background(), tcs[1].G, teamname, true /* permanent */)) 31 kbtest.DeleteAccount(*tcs[1], fus[1]) 32 33 // See if user 2 can still load team. 34 _, err := Load(context.Background(), tcs[2].G, keybase1.LoadTeamArg{ 35 Name: teamname, 36 ForceRepoll: true, 37 }) 38 require.NoError(t, err) 39 }