mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Following the pattern set up by Martin and Lucas for similar PRs. Can be reviewed by commits: 1. move scep directory into monorepo 2. update import paths 3. update go.mod, go.sum 4. fix golint errors in scep package 5. skip a failing test that's been broken for a while 6. fix that failing test # Checklist for submitter If some of the following don't apply, delete the relevant line. <!-- Note that API documentation changes are now addressed by the product design team. --> - [x] Manual QA for all new/changed functionality Also verified that our test suite runs the `scep` tests.
66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
// Automatically generated by mockimpl. DO NOT EDIT!
|
|
|
|
package mock
|
|
|
|
import (
|
|
"crypto/rsa"
|
|
"crypto/x509"
|
|
"math/big"
|
|
"sync"
|
|
|
|
"github.com/fleetdm/fleet/v4/server/mdm/scep/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)
|
|
}
|