1
// Copyright 2016 Canonical Ltd.
2
// Licensed under the AGPLv3, see LICENCE file for details.
11
"github.com/juju/juju/juju/osenv"
12
jujutesting "github.com/juju/juju/juju/testing"
15
type CmdRelationSuite struct {
16
jujutesting.JujuConnSuite
20
func (s *CmdRelationSuite) SetUpTest(c *gc.C) {
21
s.JujuConnSuite.SetUpTest(c)
22
os.Setenv(osenv.JujuModelEnvKey, "")
24
s.apps = []string{"wordpress", "mysql"}
25
for _, app := range s.apps {
26
ch := s.AddTestingCharm(c, app)
27
s.AddTestingService(c, app, ch)
31
func (s *CmdRelationSuite) TestAddRelationSuccess(c *gc.C) {
32
runCommandExpectSuccess(c, "add-relation", s.apps...)
35
func (s *CmdRelationSuite) TestAddRelationFail(c *gc.C) {
36
runCommandExpectSuccess(c, "add-relation", s.apps...)
37
runCommandExpectFailure(c, "add-relation", `cannot add relation "wordpress:db mysql:server": relation already exists`, s.apps...)
40
func (s *CmdRelationSuite) TestRemoveRelationSuccess(c *gc.C) {
41
runCommandExpectSuccess(c, "add-relation", s.apps...)
42
runCommandExpectSuccess(c, "remove-relation", s.apps...)
45
func (s *CmdRelationSuite) TestRemoveRelationFail(c *gc.C) {
46
runCommandExpectFailure(c, "remove-relation", `relation "wordpress:db mysql:server" not found`, s.apps...)