launchpad.net/~rogpeppe/juju-core/500-errgo-fix@v0.0.0-20140213181702-000000002356/cmd/juju/endpoint_test.go (about)

     1  // Copyright 2012, 2013 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package main
     5  
     6  import (
     7  	"bytes"
     8  	"fmt"
     9  
    10  	gc "launchpad.net/gocheck"
    11  
    12  	"launchpad.net/juju-core/cmd"
    13  	"launchpad.net/juju-core/juju/testing"
    14  	coretesting "launchpad.net/juju-core/testing"
    15  )
    16  
    17  type EndpointSuite struct {
    18  	testing.JujuConnSuite
    19  }
    20  
    21  var _ = gc.Suite(&EndpointSuite{})
    22  
    23  func (s *EndpointSuite) TestEndpoint(c *gc.C) {
    24  	ctx := coretesting.Context(c)
    25  	code := cmd.Main(&EndpointCommand{}, ctx, []string{})
    26  	c.Check(code, gc.Equals, 0)
    27  	c.Assert(ctx.Stderr.(*bytes.Buffer).String(), gc.Equals, "")
    28  	output := string(ctx.Stdout.(*bytes.Buffer).Bytes())
    29  	info := s.APIInfo(c)
    30  	c.Assert(output, gc.Equals, fmt.Sprintf("%s\n", info.Addrs[0]))
    31  }