aboutsummaryrefslogtreecommitdiff
path: root/internal/fusefrontend_reverse_v1api/mocks_test.go
blob: fd2f940b25a9fa595a4d3c3e0376e13fc3ebeeb9 (plain)
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
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
}