github.com/spline-fu/mattermost-server@v4.10.10+incompatible/cmd/commands/sampledata_test.go (about)

     1  // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
     2  // See License.txt for license information.
     3  
     4  package commands
     5  
     6  import (
     7  	"testing"
     8  
     9  	"github.com/mattermost/mattermost-server/api"
    10  	"github.com/mattermost/mattermost-server/cmd"
    11  	"github.com/stretchr/testify/require"
    12  )
    13  
    14  func TestSampledataBadParameters(t *testing.T) {
    15  	th := api.Setup().InitBasic()
    16  	defer th.TearDown()
    17  
    18  	// should fail because you need at least 1 worker
    19  	require.Error(t, cmd.RunCommand(t, "sampledata", "--workers", "0"))
    20  
    21  	// should fail because you have more team memberships than teams
    22  	require.Error(t, cmd.RunCommand(t, "sampledata", "--teams", "10", "--teams-memberships", "11"))
    23  
    24  	// should fail because you have more channel memberships than channels per team
    25  	require.Error(t, cmd.RunCommand(t, "sampledata", "--channels-per-team", "10", "--channel-memberships", "11"))
    26  }