corso/src/internal/operations/operation_test.go
Keepers 2104e66fea
add graph connector to backupOp (#165)
Adds graph connector to the backup operation implementation.
This includes feeding the account credentials into the
backup as well.
2022-06-08 17:32:14 -06:00

44 lines
902 B
Go

package operations
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"
"github.com/alcionai/corso/internal/kopia"
)
type OperationSuite struct {
suite.Suite
}
func TestOperationSuite(t *testing.T) {
suite.Run(t, new(OperationSuite))
}
func (suite *OperationSuite) TestNewOperation() {
t := suite.T()
op := newOperation(OperationOpts{}, nil)
assert.NotNil(t, op.Errors)
assert.NotNil(t, op.ID)
}
func (suite *OperationSuite) TestOperation_Validate() {
kwStub := &kopia.KopiaWrapper{}
table := []struct {
name string
kw *kopia.KopiaWrapper
errCheck assert.ErrorAssertionFunc
}{
{"good", kwStub, assert.NoError},
{"missing kopia", nil, assert.Error},
}
for _, test := range table {
suite.T().Run(test.name, func(t *testing.T) {
op := newOperation(OperationOpts{}, test.kw)
test.errCheck(t, op.validate())
})
}
}