github.com/saucelabs/saucectl@v0.175.1/internal/mocks/insights.go (about)

     1  package mocks
     2  
     3  import (
     4  	"context"
     5  
     6  	"github.com/saucelabs/saucectl/internal/iam"
     7  	"github.com/saucelabs/saucectl/internal/insights"
     8  	"github.com/saucelabs/saucectl/internal/job"
     9  )
    10  
    11  type FakeInsightService struct {
    12  	GetHistoryFn  func(ctx context.Context, user iam.User, sortBy string) (insights.JobHistory, error)
    13  	PostTestRunFn func(context.Context, []insights.TestRun) error
    14  	ListJobsFn    func(ctx context.Context, opts insights.ListJobsOptions) ([]job.Job, error)
    15  	ReadJobFn     func(ctx context.Context, id string) (job.Job, error)
    16  }
    17  
    18  func (f FakeInsightService) GetHistory(ctx context.Context, user iam.User, sortBy string) (insights.JobHistory, error) {
    19  	return f.GetHistoryFn(ctx, user, sortBy)
    20  }
    21  
    22  func (f FakeInsightService) PostTestRun(ctx context.Context, runs []insights.TestRun) error {
    23  	return f.PostTestRunFn(ctx, runs)
    24  }
    25  
    26  func (f FakeInsightService) ListJobs(ctx context.Context, opts insights.ListJobsOptions) ([]job.Job, error) {
    27  	return f.ListJobsFn(ctx, opts)
    28  }
    29  
    30  func (f FakeInsightService) ReadJob(ctx context.Context, id string) (job.Job, error) {
    31  	return f.ReadJobFn(ctx, id)
    32  }