github.com/makyo/juju@v0.0.0-20160425123129-2608902037e9/cmd/juju/cloud/show_test.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package cloud_test
     5  
     6  import (
     7  	jc "github.com/juju/testing/checkers"
     8  	gc "gopkg.in/check.v1"
     9  
    10  	"github.com/juju/juju/cmd/juju/cloud"
    11  	_ "github.com/juju/juju/provider/all"
    12  	"github.com/juju/juju/testing"
    13  )
    14  
    15  type showSuite struct {
    16  	testing.FakeJujuXDGDataHomeSuite
    17  }
    18  
    19  var _ = gc.Suite(&showSuite{})
    20  
    21  func (s *showSuite) TestShowBadArgs(c *gc.C) {
    22  	_, err := testing.RunCommand(c, cloud.NewShowCloudCommand())
    23  	c.Assert(err, gc.ErrorMatches, "no cloud specified")
    24  }
    25  
    26  func (s *showSuite) TestShow(c *gc.C) {
    27  	ctx, err := testing.RunCommand(c, cloud.NewShowCloudCommand(), "aws-china")
    28  	c.Assert(err, jc.ErrorIsNil)
    29  	out := testing.Stdout(ctx)
    30  	c.Assert(out, gc.Equals, `
    31  defined: public
    32  type: ec2
    33  auth-types: [access-key]
    34  regions:
    35    cn-north-1:
    36      endpoint: https://ec2.cn-north-1.amazonaws.com.cn/
    37  `[1:])
    38  }