Initial cloud-services repo - gateway service + pkg modules

This commit is contained in:
Chris Rai
2026-01-30 23:14:52 -05:00
commit fbb820d7b3
1037 changed files with 171318 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
package mocks
import (
"github.com/go-pg/pg/v10/orm"
"fiskerinc.com/modules/common"
"fiskerinc.com/modules/validator"
)
// CarUpdate query methods
type MockCertificates struct {
DBMockHelper
MockListResponse []common.Certificate
MockCertificate *common.Certificate
}
func (c *MockCertificates) Insert(cert *common.Certificate) (orm.Result, error) {
return c.ORMResponse, c.Error
}
func (c *MockCertificates) Update(cert *common.Certificate) (orm.Result, error) {
if cert.SerialNumber == "" {
return nil, &validator.FieldError{
ErrorMsg: "Serial number required",
}
}
return c.ORMResponse, c.Error
}
func (c *MockCertificates) Remove(cert *common.Certificate) (orm.Result, error) {
if cert.SerialNumber == "" {
return nil, &validator.FieldError{
ErrorMsg: "Serial number required",
}
}
return c.ORMResponse, c.Error
}
func (c *MockCertificates) SelectByCommonName(cn string) ([]common.Certificate, error) {
return c.MockListResponse, c.Error
}
func (c *MockCertificates) SelectBySerial(serial string) (*common.Certificate, error) {
return c.MockCertificate, c.Error
}
func (c *MockCertificates) SelectMostRecent(cn string, certType string) (*common.Certificate, error) {
return c.MockCertificate, c.Error
}
func (c *MockCertificates) SelectMostRecents(cn string, certTypes []string) ([]common.Certificate, error) {
return c.MockListResponse, c.Error
}