libgocryptfs/internal/fusefrontend_reverse_v1api/mocks_test.go
Jakob Unterwurzacher 13dc7657ba v2api/reverse: move old fusefrontend_reverse out of the way
fusefrontend_reverse -> fusefrontend_reverse_v1api
2020-08-01 21:14:10 +02:00

33 lines
735 B
Go

package fusefrontend_reverse
import (
"github.com/rfjakob/gocryptfs/internal/nametransform"
)
type IgnoreParserMock struct {
toExclude string
calledWith string
}
func (parser *IgnoreParserMock) MatchesPath(f string) bool {
parser.calledWith = f
return f == parser.toExclude
}
type NameTransformMock struct {
nametransform.NameTransform
}
func (n *NameTransformMock) DecryptName(cipherName string, iv []byte) (string, error) {
return "mockdecrypt_" + cipherName, nil
}
func createRFSWithMocks() (*ReverseFS, *IgnoreParserMock) {
ignorerMock := &IgnoreParserMock{}
nameTransformMock := &NameTransformMock{}
var rfs ReverseFS
rfs.excluder = ignorerMock
rfs.nameTransform = nameTransformMock
return &rfs, ignorerMock
}