github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/worker/httpserver/mock_test.go (about)

     1  // Copyright 2018 Canonical Ltd.
     2  // Licensed under the AGPLv3, see LICENCE file for details.
     3  
     4  package httpserver_test
     5  
     6  import (
     7  	"crypto/tls"
     8  
     9  	"github.com/juju/testing"
    10  	"github.com/prometheus/client_golang/prometheus"
    11  
    12  	"github.com/juju/juju/state"
    13  )
    14  
    15  type stubStateTracker struct {
    16  	testing.Stub
    17  	pool state.StatePool
    18  }
    19  
    20  func (s *stubStateTracker) Use() (*state.StatePool, error) {
    21  	s.MethodCall(s, "Use")
    22  	return &s.pool, s.NextErr()
    23  }
    24  
    25  func (s *stubStateTracker) Done() error {
    26  	s.MethodCall(s, "Done")
    27  	return s.NextErr()
    28  }
    29  
    30  func (s *stubStateTracker) Report() map[string]interface{} {
    31  	s.MethodCall(s, "Report")
    32  	return nil
    33  }
    34  
    35  type stubPrometheusRegisterer struct {
    36  	testing.Stub
    37  }
    38  
    39  func (s *stubPrometheusRegisterer) MustRegister(...prometheus.Collector) {
    40  	panic("should not be called")
    41  }
    42  
    43  func (s *stubPrometheusRegisterer) Register(c prometheus.Collector) error {
    44  	s.MethodCall(s, "Register", c)
    45  	return s.NextErr()
    46  }
    47  
    48  func (s *stubPrometheusRegisterer) Unregister(c prometheus.Collector) bool {
    49  	s.MethodCall(s, "Unregister", c)
    50  	return false
    51  }
    52  
    53  type stubCertWatcher struct {
    54  	testing.Stub
    55  	cert tls.Certificate
    56  }
    57  
    58  func (w *stubCertWatcher) get() *tls.Certificate {
    59  	w.MethodCall(w, "get")
    60  	return &w.cert
    61  }