-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstorage_stub.go
60 lines (53 loc) · 1.45 KB
/
storage_stub.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
package main
type stubStorage struct {
page wikiPage
expectederr error
GetTagWikisFunc func(string) Tag
getPageFunc func(*wikiPage) (*wikiPage, error)
storeFileFunc func(string, []byte) error
loggerFunc func(string)
}
func (ss *stubStorage) logit(method string) {
if ss.loggerFunc != nil {
ss.loggerFunc(method)
}
}
func (ss *stubStorage) storeFile(name string, content []byte) error {
return ss.storeFileFunc(name, content)
}
func (ss *stubStorage) deleteFile(name string) error {
ss.logit("deleteFile")
return nil
}
func (ss *stubStorage) moveFile(from, to string) error {
ss.logit("moveFile")
return nil
}
func (ss *stubStorage) getWikiList(from string) []string {
ss.logit("getWikiList")
return []string{"test1", "test2"}
}
func (ss *stubStorage) getPublicPages() []string {
return []string{}
}
func (ss *stubStorage) getPage(p *wikiPage) (*wikiPage, error) {
return ss.getPageFunc(p)
}
func (ss *stubStorage) searchPages(root, query string) []string {
return []string{}
}
func (ss *stubStorage) checkForPDF(p *wikiPage) (*wikiPage, error) {
return &ss.page, ss.expectederr
}
func (ss *stubStorage) IndexTags(path string) TagIndex {
return nil
}
func (ss *stubStorage) IndexRawFiles(path, fileExtension string, existing TagIndex) TagIndex {
return nil
}
func (ss *stubStorage) GetTagWikis(tag string) Tag {
return ss.GetTagWikisFunc(tag)
}
func (ss *stubStorage) IndexWikiFiles(base, path string) []wikiNav {
return nil
}