mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
edc0324ac0
this uses the associated new version in our fork
ecbb3041ea
to allow for concurrent access to mocks
67 lines
1.4 KiB
Go
67 lines
1.4 KiB
Go
// Automatically generated by mockimpl. DO NOT EDIT!
|
|
|
|
package mock
|
|
|
|
import (
|
|
"crypto/rsa"
|
|
"crypto/x509"
|
|
"math/big"
|
|
"sync"
|
|
|
|
"github.com/micromdm/scep/v2/depot"
|
|
)
|
|
|
|
var _ depot.Depot = (*Depot)(nil)
|
|
|
|
type CAFunc func(pass []byte) ([]*x509.Certificate, *rsa.PrivateKey, error)
|
|
|
|
type PutFunc func(name string, crt *x509.Certificate) error
|
|
|
|
type SerialFunc func() (*big.Int, error)
|
|
|
|
type HasCNFunc func(cn string, allowTime int, cert *x509.Certificate, revokeOldCertificate bool) (bool, error)
|
|
|
|
type Depot struct {
|
|
CAFunc CAFunc
|
|
CAFuncInvoked bool
|
|
|
|
PutFunc PutFunc
|
|
PutFuncInvoked bool
|
|
|
|
SerialFunc SerialFunc
|
|
SerialFuncInvoked bool
|
|
|
|
HasCNFunc HasCNFunc
|
|
HasCNFuncInvoked bool
|
|
|
|
mu sync.Mutex
|
|
}
|
|
|
|
func (d *Depot) CA(pass []byte) ([]*x509.Certificate, *rsa.PrivateKey, error) {
|
|
d.mu.Lock()
|
|
d.CAFuncInvoked = true
|
|
d.mu.Unlock()
|
|
return d.CAFunc(pass)
|
|
}
|
|
|
|
func (d *Depot) Put(name string, crt *x509.Certificate) error {
|
|
d.mu.Lock()
|
|
d.PutFuncInvoked = true
|
|
d.mu.Unlock()
|
|
return d.PutFunc(name, crt)
|
|
}
|
|
|
|
func (d *Depot) Serial() (*big.Int, error) {
|
|
d.mu.Lock()
|
|
d.SerialFuncInvoked = true
|
|
d.mu.Unlock()
|
|
return d.SerialFunc()
|
|
}
|
|
|
|
func (d *Depot) HasCN(cn string, allowTime int, cert *x509.Certificate, revokeOldCertificate bool) (bool, error) {
|
|
d.mu.Lock()
|
|
d.HasCNFuncInvoked = true
|
|
d.mu.Unlock()
|
|
return d.HasCNFunc(cn, allowTime, cert, revokeOldCertificate)
|
|
}
|