github.com/sap/cf-mta-plugin@v2.6.3+incompatible/clients/baseclient/test_token_factory.go (about)

     1  package baseclient
     2  
     3  import (
     4  	"github.com/cloudfoundry-incubator/multiapps-cli-plugin/testutil"
     5  	"github.com/go-openapi/runtime"
     6  )
     7  
     8  // NewCustomTokenFactory represents mock of the TokenFactory
     9  func NewCustomTokenFactory(token string) TokenFactory {
    10  	return &customTokenfactory{tokenString: token}
    11  }
    12  
    13  type customTokenfactory struct {
    14  	tokenString string
    15  }
    16  
    17  func (c *customTokenfactory) NewToken() (runtime.ClientAuthInfoWriter, error) {
    18  	return testutil.NewCustomBearerToken(c.tokenString), nil
    19  }