github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/cmd/juju/romulus/commands/commands_test.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package commands_test
     5  
     6  import (
     7  	stdtesting "testing"
     8  
     9  	"github.com/juju/cmd"
    10  	gc "gopkg.in/check.v1"
    11  
    12  	"github.com/juju/juju/cmd/juju/romulus/commands"
    13  )
    14  
    15  type commandSuite struct{}
    16  
    17  var _ = gc.Suite(&commandSuite{})
    18  
    19  type mockRegister struct {
    20  	commands []string
    21  }
    22  
    23  func (m *mockRegister) Register(command cmd.Command) {
    24  	m.commands = append(m.commands, command.Info().Name)
    25  }
    26  
    27  func TestAll(t *stdtesting.T) {
    28  	gc.TestingT(t)
    29  }
    30  
    31  func (s *commandSuite) TestRegister(c *gc.C) {
    32  	m := &mockRegister{}
    33  	commands.RegisterAll(m)
    34  	c.Assert(m.commands, gc.DeepEquals, []string{
    35  		"agree",
    36  		"agreements",
    37  		"allocate",
    38  		"budgets",
    39  		"create-budget",
    40  		"plans",
    41  		"set-budget",
    42  		"set-plan",
    43  		"show-budget",
    44  		"update-allocation",
    45  	})
    46  }