github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/apiserver/client/bundles_test.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package client_test
     5  
     6  import (
     7  	jc "github.com/juju/testing/checkers"
     8  	gc "gopkg.in/check.v1"
     9  
    10  	"github.com/juju/juju/apiserver/params"
    11  )
    12  
    13  // This test is here only to make sure that the endpoint is still provided by
    14  // the Client facade. For full coverage, see tests in the Bundle facade.
    15  func (s *serverSuite) TestGetBundleChangesSuccess(c *gc.C) {
    16  	args := params.BundleChangesParams{
    17  		BundleDataYAML: `
    18              applications:
    19                  django:
    20                      charm: django
    21                      options:
    22                          debug: true
    23                      storage:
    24                          tmpfs: tmpfs,1G
    25                  haproxy:
    26                      charm: cs:trusty/haproxy-42
    27              relations:
    28                  - - django:web
    29                    - haproxy:web
    30          `,
    31  	}
    32  	r, err := s.client.GetBundleChanges(args)
    33  	c.Assert(err, jc.ErrorIsNil)
    34  	c.Assert(r.Changes, jc.DeepEquals, []*params.BundleChange{{
    35  		Id:     "addCharm-0",
    36  		Method: "addCharm",
    37  		Args:   []interface{}{"django", ""},
    38  	}, {
    39  		Id:     "deploy-1",
    40  		Method: "deploy",
    41  		Args: []interface{}{
    42  			"$addCharm-0",
    43  			"",
    44  			"django",
    45  			map[string]interface{}{"debug": true},
    46  			"",
    47  			map[string]string{"tmpfs": "tmpfs,1G"},
    48  			map[string]string{},
    49  			map[string]int{},
    50  		},
    51  		Requires: []string{"addCharm-0"},
    52  	}, {
    53  		Id:     "addCharm-2",
    54  		Method: "addCharm",
    55  		Args:   []interface{}{"cs:trusty/haproxy-42", "trusty"},
    56  	}, {
    57  		Id:     "deploy-3",
    58  		Method: "deploy",
    59  		Args: []interface{}{
    60  			"$addCharm-2",
    61  			"trusty",
    62  			"haproxy",
    63  			map[string]interface{}{},
    64  			"",
    65  			map[string]string{},
    66  			map[string]string{},
    67  			map[string]int{},
    68  		},
    69  		Requires: []string{"addCharm-2"},
    70  	}, {
    71  		Id:       "addRelation-4",
    72  		Method:   "addRelation",
    73  		Args:     []interface{}{"$deploy-1:web", "$deploy-3:web"},
    74  		Requires: []string{"deploy-1", "deploy-3"},
    75  	}})
    76  	c.Assert(r.Errors, gc.IsNil)
    77  }