github.com/rogpeppe/juju@v0.0.0-20140613142852-6337964b789e/juju/mock_test.go (about)

     1  package juju_test
     2  
     3  import (
     4  	"github.com/juju/juju/juju"
     5  	"github.com/juju/juju/network"
     6  	"github.com/juju/juju/state/api"
     7  )
     8  
     9  type mockAPIState struct {
    10  	close func(juju.APIState) error
    11  
    12  	apiHostPorts [][]network.HostPort
    13  	environTag   string
    14  }
    15  
    16  func (s *mockAPIState) Close() error {
    17  	if s.close != nil {
    18  		return s.close(s)
    19  	}
    20  	return nil
    21  }
    22  
    23  func (s *mockAPIState) APIHostPorts() [][]network.HostPort {
    24  	return s.apiHostPorts
    25  }
    26  
    27  func (s *mockAPIState) EnvironTag() string {
    28  	return s.environTag
    29  }
    30  
    31  func panicAPIOpen(apiInfo *api.Info, opts api.DialOpts) (juju.APIState, error) {
    32  	panic("api.Open called unexpectedly")
    33  }