-
Notifications
You must be signed in to change notification settings - Fork 19
/
backend.go
81 lines (65 loc) · 1.94 KB
/
backend.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
* UpdateHub
* Copyright (C) 2017
* O.S. Systems Sofware LTDA: contato@ossystems.com.br
*
* SPDX-License-Identifier: Apache-2.0
*/
package filesystemmock
import (
"os"
"time"
"github.com/spf13/afero"
"github.com/stretchr/testify/mock"
)
type FileSystemBackendMock struct {
mock.Mock
}
func (fom *FileSystemBackendMock) Open(name string) (afero.File, error) {
args := fom.Called(name)
return args.Get(0).(afero.File), args.Error(1)
}
func (fom *FileSystemBackendMock) Create(name string) (afero.File, error) {
args := fom.Called(name)
return args.Get(0).(afero.File), args.Error(1)
}
func (fom *FileSystemBackendMock) OpenFile(name string, flag int, perm os.FileMode) (afero.File, error) {
args := fom.Called(name, flag, perm)
return args.Get(0).(afero.File), args.Error(1)
}
func (fom *FileSystemBackendMock) Chmod(name string, mode os.FileMode) error {
args := fom.Called(name, mode)
return args.Error(0)
}
func (fom *FileSystemBackendMock) Chtimes(name string, atime time.Time, mtime time.Time) error {
args := fom.Called(name, atime, mtime)
return args.Error(0)
}
func (fom *FileSystemBackendMock) Mkdir(name string, perm os.FileMode) error {
args := fom.Called(name, perm)
return args.Error(0)
}
func (fom *FileSystemBackendMock) MkdirAll(path string, perm os.FileMode) error {
args := fom.Called(path, perm)
return args.Error(0)
}
func (fom *FileSystemBackendMock) Name() string {
args := fom.Called()
return args.String(0)
}
func (fom *FileSystemBackendMock) Remove(name string) error {
args := fom.Called(name)
return args.Error(0)
}
func (fom *FileSystemBackendMock) RemoveAll(path string) error {
args := fom.Called(path)
return args.Error(0)
}
func (fom *FileSystemBackendMock) Rename(oldname, newname string) error {
args := fom.Called(oldname, newname)
return args.Error(0)
}
func (fom *FileSystemBackendMock) Stat(name string) (os.FileInfo, error) {
args := fom.Called(name)
return args.Get(0).(os.FileInfo), args.Error(1)
}