Files
cocos/pkg/sdk/mocks/sdk.go
T
Danko Miladinovic 67f939fc66
CI / checkproto (push) Has been cancelled
CI / ci (push) Has been cancelled
Rust CI Pipeline / rust-check (push) Has been cancelled
COCOS-326 - Add vTPM support to CoCoS (#376)
* manager, cli and agent vtpm support

* rebase and changed atls for vtpm

* deleted unused code

* changed chekproto.yaml script so it find the manager proto file correctly

* fixe manager proto version

* fix agent tests

* fix server agent test

* fix attestation test

* fix attestation test gofumpt

* created dummy RWC for TPM

* fix comment

* add default PCR values

* rebase main

* fix rust ci and missing header

* changed embedded  attestation to VMPL 2

* fix unused impot

* fix pkg test

* address attestation type

* fix agent attestation test

* add prc15 check

* fix comments

* fix cli tests

* add doc

* add mock for LeveledQuoteProvider when SEV-SNP device is not found

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* fix manager reading attestation policy

* refactor PCR value checks and update attestation policy values

Signed-off-by: Sammy Oina <sammyoina@gmail.com>

* fix tests for sev and grpc

---------

Signed-off-by: Sammy Oina <sammyoina@gmail.com>
Co-authored-by: Sammy Oina <sammyoina@gmail.com>
2025-03-07 16:36:47 +01:00

237 lines
7.1 KiB
Go

// Copyright (c) Ultraviolet
// SPDX-License-Identifier: Apache-2.0
// Code generated by mockery v2.43.2. DO NOT EDIT.
package mocks
import (
context "context"
os "os"
mock "github.com/stretchr/testify/mock"
)
// SDK is an autogenerated mock type for the SDK type
type SDK struct {
mock.Mock
}
type SDK_Expecter struct {
mock *mock.Mock
}
func (_m *SDK) EXPECT() *SDK_Expecter {
return &SDK_Expecter{mock: &_m.Mock}
}
// Algo provides a mock function with given fields: ctx, algorithm, requirements, privKey
func (_m *SDK) Algo(ctx context.Context, algorithm *os.File, requirements *os.File, privKey interface{}) error {
ret := _m.Called(ctx, algorithm, requirements, privKey)
if len(ret) == 0 {
panic("no return value specified for Algo")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *os.File, *os.File, interface{}) error); ok {
r0 = rf(ctx, algorithm, requirements, privKey)
} else {
r0 = ret.Error(0)
}
return r0
}
// SDK_Algo_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Algo'
type SDK_Algo_Call struct {
*mock.Call
}
// Algo is a helper method to define mock.On call
// - ctx context.Context
// - algorithm *os.File
// - requirements *os.File
// - privKey interface{}
func (_e *SDK_Expecter) Algo(ctx interface{}, algorithm interface{}, requirements interface{}, privKey interface{}) *SDK_Algo_Call {
return &SDK_Algo_Call{Call: _e.mock.On("Algo", ctx, algorithm, requirements, privKey)}
}
func (_c *SDK_Algo_Call) Run(run func(ctx context.Context, algorithm *os.File, requirements *os.File, privKey interface{})) *SDK_Algo_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*os.File), args[2].(*os.File), args[3].(interface{}))
})
return _c
}
func (_c *SDK_Algo_Call) Return(_a0 error) *SDK_Algo_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *SDK_Algo_Call) RunAndReturn(run func(context.Context, *os.File, *os.File, interface{}) error) *SDK_Algo_Call {
_c.Call.Return(run)
return _c
}
// Attestation provides a mock function with given fields: ctx, reportData, nonce, attType, attestationFile
func (_m *SDK) Attestation(ctx context.Context, reportData [64]byte, nonce [32]byte, attType int, attestationFile *os.File) error {
ret := _m.Called(ctx, reportData, nonce, attType, attestationFile)
if len(ret) == 0 {
panic("no return value specified for Attestation")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, [64]byte, [32]byte, int, *os.File) error); ok {
r0 = rf(ctx, reportData, nonce, attType, attestationFile)
} else {
r0 = ret.Error(0)
}
return r0
}
// SDK_Attestation_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Attestation'
type SDK_Attestation_Call struct {
*mock.Call
}
// Attestation is a helper method to define mock.On call
// - ctx context.Context
// - reportData [64]byte
// - nonce [32]byte
// - attType int
// - attestationFile *os.File
func (_e *SDK_Expecter) Attestation(ctx interface{}, reportData interface{}, nonce interface{}, attType interface{}, attestationFile interface{}) *SDK_Attestation_Call {
return &SDK_Attestation_Call{Call: _e.mock.On("Attestation", ctx, reportData, nonce, attType, attestationFile)}
}
func (_c *SDK_Attestation_Call) Run(run func(ctx context.Context, reportData [64]byte, nonce [32]byte, attType int, attestationFile *os.File)) *SDK_Attestation_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].([64]byte), args[2].([32]byte), args[3].(int), args[4].(*os.File))
})
return _c
}
func (_c *SDK_Attestation_Call) Return(_a0 error) *SDK_Attestation_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *SDK_Attestation_Call) RunAndReturn(run func(context.Context, [64]byte, [32]byte, int, *os.File) error) *SDK_Attestation_Call {
_c.Call.Return(run)
return _c
}
// Data provides a mock function with given fields: ctx, dataset, filename, privKey
func (_m *SDK) Data(ctx context.Context, dataset *os.File, filename string, privKey interface{}) error {
ret := _m.Called(ctx, dataset, filename, privKey)
if len(ret) == 0 {
panic("no return value specified for Data")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, *os.File, string, interface{}) error); ok {
r0 = rf(ctx, dataset, filename, privKey)
} else {
r0 = ret.Error(0)
}
return r0
}
// SDK_Data_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Data'
type SDK_Data_Call struct {
*mock.Call
}
// Data is a helper method to define mock.On call
// - ctx context.Context
// - dataset *os.File
// - filename string
// - privKey interface{}
func (_e *SDK_Expecter) Data(ctx interface{}, dataset interface{}, filename interface{}, privKey interface{}) *SDK_Data_Call {
return &SDK_Data_Call{Call: _e.mock.On("Data", ctx, dataset, filename, privKey)}
}
func (_c *SDK_Data_Call) Run(run func(ctx context.Context, dataset *os.File, filename string, privKey interface{})) *SDK_Data_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(*os.File), args[2].(string), args[3].(interface{}))
})
return _c
}
func (_c *SDK_Data_Call) Return(_a0 error) *SDK_Data_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *SDK_Data_Call) RunAndReturn(run func(context.Context, *os.File, string, interface{}) error) *SDK_Data_Call {
_c.Call.Return(run)
return _c
}
// Result provides a mock function with given fields: ctx, privKey, resultFile
func (_m *SDK) Result(ctx context.Context, privKey interface{}, resultFile *os.File) error {
ret := _m.Called(ctx, privKey, resultFile)
if len(ret) == 0 {
panic("no return value specified for Result")
}
var r0 error
if rf, ok := ret.Get(0).(func(context.Context, interface{}, *os.File) error); ok {
r0 = rf(ctx, privKey, resultFile)
} else {
r0 = ret.Error(0)
}
return r0
}
// SDK_Result_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Result'
type SDK_Result_Call struct {
*mock.Call
}
// Result is a helper method to define mock.On call
// - ctx context.Context
// - privKey interface{}
// - resultFile *os.File
func (_e *SDK_Expecter) Result(ctx interface{}, privKey interface{}, resultFile interface{}) *SDK_Result_Call {
return &SDK_Result_Call{Call: _e.mock.On("Result", ctx, privKey, resultFile)}
}
func (_c *SDK_Result_Call) Run(run func(ctx context.Context, privKey interface{}, resultFile *os.File)) *SDK_Result_Call {
_c.Call.Run(func(args mock.Arguments) {
run(args[0].(context.Context), args[1].(interface{}), args[2].(*os.File))
})
return _c
}
func (_c *SDK_Result_Call) Return(_a0 error) *SDK_Result_Call {
_c.Call.Return(_a0)
return _c
}
func (_c *SDK_Result_Call) RunAndReturn(run func(context.Context, interface{}, *os.File) error) *SDK_Result_Call {
_c.Call.Return(run)
return _c
}
// NewSDK creates a new instance of SDK. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
// The first argument is typically a *testing.T value.
func NewSDK(t interface {
mock.TestingT
Cleanup(func())
}) *SDK {
mock := &SDK{}
mock.Mock.Test(t)
t.Cleanup(func() { mock.AssertExpectations(t) })
return mock
}