mirror of
https://github.com/status-im/consul.git
synced 2025-03-03 06:40:45 +00:00
Having this type live in the agent/consul package makes it difficult to put anything that relies on token resolution (e.g. the new gRPC services) in separate packages without introducing import cycles. For example, if package foo imports agent/consul for the ACLResolveResult type it means that agent/consul cannot import foo to register its service. We've previously worked around this by wrapping the ACLResolver to "downgrade" its return type to an acl.Authorizer - aside from the added complexity, this also loses the resolved identity information. In the future, we may want to move the whole ACLResolver into the acl/resolver package. For now, putting the result type there at least, fixes the immediate import cycle issues.
53 lines
1.3 KiB
Go
53 lines
1.3 KiB
Go
// Code generated by mockery v2.12.0. DO NOT EDIT.
|
|
|
|
package connectca
|
|
|
|
import (
|
|
acl "github.com/hashicorp/consul/acl"
|
|
mock "github.com/stretchr/testify/mock"
|
|
|
|
structs "github.com/hashicorp/consul/agent/structs"
|
|
|
|
testing "testing"
|
|
|
|
x509 "crypto/x509"
|
|
)
|
|
|
|
// MockCAManager is an autogenerated mock type for the CAManager type
|
|
type MockCAManager struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// AuthorizeAndSignCertificate provides a mock function with given fields: csr, authz
|
|
func (_m *MockCAManager) AuthorizeAndSignCertificate(csr *x509.CertificateRequest, authz acl.Authorizer) (*structs.IssuedCert, error) {
|
|
ret := _m.Called(csr, authz)
|
|
|
|
var r0 *structs.IssuedCert
|
|
if rf, ok := ret.Get(0).(func(*x509.CertificateRequest, acl.Authorizer) *structs.IssuedCert); ok {
|
|
r0 = rf(csr, authz)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*structs.IssuedCert)
|
|
}
|
|
}
|
|
|
|
var r1 error
|
|
if rf, ok := ret.Get(1).(func(*x509.CertificateRequest, acl.Authorizer) error); ok {
|
|
r1 = rf(csr, authz)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewMockCAManager creates a new instance of MockCAManager. It also registers the testing.TB interface on the mock and a cleanup function to assert the mocks expectations.
|
|
func NewMockCAManager(t testing.TB) *MockCAManager {
|
|
mock := &MockCAManager{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|