github.com/qichengzx/mattermost-server@v4.5.1-0.20180604164826-2c75247c97d0+incompatible/cmd/mattermost/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/api4"
    10  	"github.com/stretchr/testify/require"
    11  )
    12  
    13  func TestSampledataBadParameters(t *testing.T) {
    14  	th := api4.Setup().InitBasic()
    15  	defer th.TearDown()
    16  
    17  	// should fail because you need at least 1 worker
    18  	require.Error(t, RunCommand(t, "sampledata", "--workers", "0"))
    19  
    20  	// should fail because you have more team memberships than teams
    21  	require.Error(t, RunCommand(t, "sampledata", "--teams", "10", "--teams-memberships", "11"))
    22  
    23  	// should fail because you have more channel memberships than channels per team
    24  	require.Error(t, RunCommand(t, "sampledata", "--channels-per-team", "10", "--channel-memberships", "11"))
    25  }