github.com/wallyworld/juju@v0.0.0-20161013125918-6cf1bc9d917a/resource/state/state_test.go (about)

     1  // Copyright 2015 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package state
     5  
     6  import (
     7  	"github.com/juju/testing"
     8  	gc "gopkg.in/check.v1"
     9  )
    10  
    11  var _ = gc.Suite(&StateSuite{})
    12  
    13  type StateSuite struct {
    14  	testing.IsolationSuite
    15  
    16  	stub    *testing.Stub
    17  	raw     *stubRawState
    18  	persist *stubPersistence
    19  	storage *stubStorage
    20  }
    21  
    22  func (s *StateSuite) SetUpTest(c *gc.C) {
    23  	s.IsolationSuite.SetUpTest(c)
    24  
    25  	s.stub = &testing.Stub{}
    26  	s.raw = &stubRawState{stub: s.stub}
    27  	s.persist = &stubPersistence{stub: s.stub}
    28  	s.storage = &stubStorage{stub: s.stub}
    29  	s.raw.ReturnPersistence = s.persist
    30  	s.raw.ReturnStorage = s.storage
    31  }
    32  
    33  func (s *StateSuite) TestNewStateOkay(c *gc.C) {
    34  	st := NewState(s.raw)
    35  
    36  	c.Check(st, gc.NotNil)
    37  	s.stub.CheckCallNames(c, "Persistence", "Storage")
    38  }