github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/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  	"gopkg.in/juju/names.v2"
     8  
     9  	"github.com/juju/juju/api"
    10  )
    11  
    12  // mockAPIConnection implements just enough of the api.Connection interface
    13  // to satisfy the methods used by the register command.
    14  type mockAPIConnection struct {
    15  	// This will be nil - it's just there to satisfy the api.Connection
    16  	// interface methods not explicitly defined by mockAPIConnection.
    17  	api.Connection
    18  
    19  	// addr is returned by Addr.
    20  	addr string
    21  
    22  	// controllerTag is returned by ControllerTag.
    23  	controllerTag names.ControllerTag
    24  
    25  	// authTag is returned by AuthTag.
    26  	authTag names.Tag
    27  
    28  	// controllerAccess is returned by ControllerAccess.
    29  	controllerAccess string
    30  }
    31  
    32  func (*mockAPIConnection) Close() error {
    33  	return nil
    34  }
    35  
    36  func (m *mockAPIConnection) Addr() string {
    37  	return m.addr
    38  }
    39  
    40  func (m *mockAPIConnection) ControllerTag() names.ControllerTag {
    41  	return m.controllerTag
    42  }
    43  
    44  func (m *mockAPIConnection) AuthTag() names.Tag {
    45  	return m.authTag
    46  }
    47  
    48  func (m *mockAPIConnection) ControllerAccess() string {
    49  	return m.controllerAccess
    50  }