github.com/axw/juju@v0.0.0-20161005053422-4bd6544d08d4/cmd/juju/romulus/showbudget/export_test.go (about)

     1  // Copyright 2016 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package showbudget
     5  
     6  import (
     7  	"gopkg.in/macaroon-bakery.v1/httpbakery"
     8  )
     9  
    10  var (
    11  	NewBudgetAPIClient = &newBudgetAPIClient
    12  	NewAPIClient       = &newAPIClient
    13  )
    14  
    15  // APIClientFnc returns a function that returns the provided APIClient
    16  // and can be used to patch the NewAPIClient variable in tests
    17  func NewAPIClientFnc(api APIClient) func(*showBudgetCommand) (APIClient, error) {
    18  	return func(*showBudgetCommand) (APIClient, error) {
    19  		return api, nil
    20  	}
    21  }
    22  
    23  // BudgetAPIClientFnc returns a function that returns the provided budgetAPIClient
    24  // and can be used to patch the NewBudgetAPIClient variable for tests.
    25  func BudgetAPIClientFnc(api budgetAPIClient) func(*httpbakery.Client) (budgetAPIClient, error) {
    26  	return func(*httpbakery.Client) (budgetAPIClient, error) {
    27  		return api, nil
    28  	}
    29  }