~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/state/relation_internal_test.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2012, 2013 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
 
4
package state
 
5
 
 
6
import (
 
7
        jc "github.com/juju/testing/checkers"
 
8
        gc "gopkg.in/check.v1"
 
9
        "gopkg.in/juju/charm.v6-unstable"
 
10
)
 
11
 
 
12
type RelationSuite struct{}
 
13
 
 
14
var _ = gc.Suite(&RelationSuite{})
 
15
 
 
16
// TestRelatedEndpoints verifies the behaviour of RelatedEndpoints in
 
17
// multi-endpoint peer relations, which are currently not constructable
 
18
// by normal means.
 
19
func (s *RelationSuite) TestRelatedEndpoints(c *gc.C) {
 
20
        rel := charm.Relation{
 
21
                Interface: "ifce",
 
22
                Name:      "group",
 
23
                Role:      charm.RolePeer,
 
24
                Scope:     charm.ScopeGlobal,
 
25
        }
 
26
        eps := []Endpoint{{
 
27
                ApplicationName: "jeff",
 
28
                Relation:        rel,
 
29
        }, {
 
30
                ApplicationName: "mike",
 
31
                Relation:        rel,
 
32
        }, {
 
33
                ApplicationName: "mike",
 
34
                Relation:        rel,
 
35
        }}
 
36
        r := &Relation{nil, relationDoc{Endpoints: eps}}
 
37
        relatedEps, err := r.RelatedEndpoints("mike")
 
38
        c.Assert(err, jc.ErrorIsNil)
 
39
        c.Assert(relatedEps, gc.DeepEquals, eps)
 
40
}