github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/cmd/juju/controller/mock_test.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package controller_test
     5  
     6  import (
     7  	"github.com/juju/juju/api"
     8  	"github.com/juju/juju/network"
     9  	"gopkg.in/juju/names.v2"
    10  )
    11  
    12  type mockAPIConnection struct {
    13  	api.Connection
    14  	info          *api.Info
    15  	opts          api.DialOpts
    16  	addr          string
    17  	apiHostPorts  [][]network.HostPort
    18  	controllerTag names.ControllerTag
    19  	username      string
    20  	password      string
    21  }
    22  
    23  func (*mockAPIConnection) Close() error {
    24  	return nil
    25  }
    26  
    27  func (m *mockAPIConnection) Addr() string {
    28  	return m.addr
    29  }
    30  
    31  func (m *mockAPIConnection) APIHostPorts() [][]network.HostPort {
    32  	return m.apiHostPorts
    33  }
    34  
    35  func (m *mockAPIConnection) ControllerTag() names.ControllerTag {
    36  	return m.controllerTag
    37  }
    38  
    39  func (m *mockAPIConnection) SetPassword(username, password string) error {
    40  	m.username = username
    41  	m.password = password
    42  	return nil
    43  }