/
store.go
36 lines (29 loc) · 932 Bytes
/
store.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package mock
import (
"context"
"github.com/khulnasoft/harbor-scanner-tunnel/pkg/harbor"
"github.com/khulnasoft/harbor-scanner-tunnel/pkg/job"
"github.com/stretchr/testify/mock"
)
type Store struct {
mock.Mock
}
func NewStore() *Store {
return &Store{}
}
func (s *Store) Create(ctx context.Context, scanJob job.ScanJob) error {
args := s.Called(ctx, scanJob)
return args.Error(0)
}
func (s *Store) Get(ctx context.Context, scanJobID string) (*job.ScanJob, error) {
args := s.Called(ctx, scanJobID)
return args.Get(0).(*job.ScanJob), args.Error(1)
}
func (s *Store) UpdateStatus(ctx context.Context, scanJobID string, newStatus job.ScanJobStatus, error ...string) error {
args := s.Called(ctx, scanJobID, newStatus, error)
return args.Error(0)
}
func (s *Store) UpdateReport(ctx context.Context, scanJobID string, report harbor.ScanReport) error {
args := s.Called(ctx, scanJobID, report)
return args.Error(0)
}