You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: database_test.go
    path of file: ./repos/grafana/pkg/services/accesscontrol/database
    
    the code of the file until where you have to start completion: package database

import (
	"context"
	"fmt"
	"strings"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"

	"github.com/grafana/grafana/pkg/infra/db"
	"github.com/grafana/grafana/pkg/infra/localcache"
	"github.com/grafana/grafana/pkg/services/accesscontrol"
	rs "github.com/grafana/grafana/pkg/services/accesscontrol/resourcepermissions"
	"github.com/grafana/grafana/pkg/services/auth/identity"
	"github.com/grafana/grafana/pkg/services/dashboards/dashboardaccess"
	"github.com/grafana/grafana/pkg/services/featuremgmt"
	"github.com/grafana/grafana/pkg/services/org
    
func TestAccessControlStore_DeleteTeamPermissions(t *testing.T) {
	t.Run("expect permissions related to team to be deleted", func(t *testing.T) {
		store, permissionsStore, sql, teamSvc, _ := setupTestEnv(t)
		user, team := createUserAndTeam(t, sql, teamSvc, 1)

		// grant permission to the team
		_, err := permissionsStore.SetTeamResourcePermission(context.Background(), 1, team.ID, rs.SetResourcePermissionCommand{
			Actions:           []string{"dashboards:write"},
			Resource:          "dashboards",
			ResourceAttribute: "uid",
			ResourceID:        "xxYYzz",
		}, nil)
		require.NoError(t, err)

		// generate permissions scoped to the team
		_, err = permissionsStore.SetUserResourcePermission(context.Background(), 1, accesscontrol.User{ID: user.ID}, rs.SetResourcePermissionCommand{
			Actions:           []string{"team:read"},
			Resource:          "teams",
			ResourceAttribute: "id",
			ResourceID:        fmt.Sprintf("%d", team.ID),
		}, nil)
		require.NoError(t, err)

		err = store.DeleteTeamPermissions(context.Background(), 1, team.ID)
		require.NoError(t, err)

		permissions, err := store.GetUserPermissions(context.Background(), accesscontrol.GetUserPermissionsQuery{
			OrgID:   1,
			UserID:  user.ID,
			Roles:   []string{"Admin"},
			TeamIDs: []int64{team.ID},
		})
		require.NoError(t, err)
		assert.Len(t, permissions, 0)
	})
	t.Run("expect permissions not related to team to be kept", func(t *testing.T) {
		store, permissionsStore, sql, teamSvc, _ := setupTestEnv(t)
		user, team := createUserAndTeam(t, sql, teamSvc, 1)

		// grant permission to the team
		_, err := permissionsStore.SetTeamResourcePermission(context.Background(), 1, team.ID, rs.SetResourcePermissionCommand{
			Actions:           []string{"dashboards:write"},
			Resource:          "dashboards",
			ResourceAttribute: "uid",
			ResourceID:        "xxYYzz",
		}, nil)
		require.NoError(t, err)

		// generate permissions scoped to another team
		_, err = permissionsStore.SetUserResourcePermission(context.Background(), 1, accesscontrol.User{ID: user.ID}, rs.SetResourcePermissionCommand{
			Actions:           []string{"team:read"},
			Resource:          "teams",
			ResourceAttribute: "id",
			ResourceID:        fmt.Sprintf("%d", team.ID+1),
		}, nil)
		require.NoError(t, err)

		err = store.DeleteTeamPermissions(context.Background(), 1, team.ID)
		require.NoError(t, err)

		permissions, err := store.GetUserPermissions(context.Background(), accesscontrol.GetUserPermissionsQuery{
			OrgID:   1,
			UserID:  user.ID,
			Roles:   []string{"Admin"},
			TeamIDs: []int64{team.ID},
		})
		require.NoError(t, err)
		assert.Len(t, permissions, 1)
	})
}