From f50aad709075c1f06bfc7285c3185382dfcdcf20 Mon Sep 17 00:00:00 2001 From: Jeff Halter <868228+jhalter@users.noreply.github.com> Date: Fri, 10 Jul 2026 09:45:04 -0700 Subject: Move testify mocks out of production files into hotline/hltest The manager mocks lived in production source so that internal/mobius tests could import them (test files are not importable across packages), which pulled testify into the production dependency graph of hotline importers, counted the mocks against coverage, and put them in the library's godoc. They now live in hotline/hltest, an httptest-style test-support package. The hotline package's own in-package tests cannot import hltest (import cycle), so the mocks they use are duplicated in mocks_test.go; conformance assertions in both files catch signature drift. MockAccountManager was only ever used inside internal/mobius and moves to a _test.go file there. --- hotline/ban.go | 74 +---------- hotline/chat.go | 37 ------ hotline/client_manager.go | 25 ---- hotline/file_store.go | 120 ----------------- hotline/hltest/mocks.go | 319 ++++++++++++++++++++++++++++++++++++++++++++++ hotline/mocks_test.go | 160 +++++++++++++++++++++++ hotline/news.go | 52 -------- 7 files changed, 483 insertions(+), 304 deletions(-) create mode 100644 hotline/hltest/mocks.go create mode 100644 hotline/mocks_test.go (limited to 'hotline') diff --git a/hotline/ban.go b/hotline/ban.go index 43988ab..343c4ff 100644 --- a/hotline/ban.go +++ b/hotline/ban.go @@ -2,8 +2,6 @@ package hotline import ( "time" - - "github.com/stretchr/testify/mock" ) // BanDuration is the length of time for temporary bans. @@ -20,86 +18,22 @@ const ( type BanMgr interface { Add(ip string, until *time.Time) error IsBanned(ip string) (bool, *time.Time) - + // IP banning UnbanIP(ip string) error - + // Username banning BanUsername(username string) error UnbanUsername(username string) error IsUsernameBanned(username string) bool - + // Nickname banning BanNickname(nickname string) error UnbanNickname(nickname string) error IsNicknameBanned(nickname string) bool - + // List operations ListBannedIPs() ([]string, error) ListBannedUsernames() ([]string, error) ListBannedNicknames() ([]string, error) } - -type MockBanMgr struct { - mock.Mock -} - -func (m *MockBanMgr) Add(ip string, until *time.Time) error { - args := m.Called(ip, until) - return args.Error(0) -} - -func (m *MockBanMgr) IsBanned(ip string) (bool, *time.Time) { - args := m.Called(ip) - return args.Bool(0), args.Get(1).(*time.Time) -} - -func (m *MockBanMgr) UnbanIP(ip string) error { - args := m.Called(ip) - return args.Error(0) -} - -func (m *MockBanMgr) BanUsername(username string) error { - args := m.Called(username) - return args.Error(0) -} - -func (m *MockBanMgr) UnbanUsername(username string) error { - args := m.Called(username) - return args.Error(0) -} - -func (m *MockBanMgr) IsUsernameBanned(username string) bool { - args := m.Called(username) - return args.Bool(0) -} - -func (m *MockBanMgr) BanNickname(nickname string) error { - args := m.Called(nickname) - return args.Error(0) -} - -func (m *MockBanMgr) UnbanNickname(nickname string) error { - args := m.Called(nickname) - return args.Error(0) -} - -func (m *MockBanMgr) IsNicknameBanned(nickname string) bool { - args := m.Called(nickname) - return args.Bool(0) -} - -func (m *MockBanMgr) ListBannedIPs() ([]string, error) { - args := m.Called() - return args.Get(0).([]string), args.Error(1) -} - -func (m *MockBanMgr) ListBannedUsernames() ([]string, error) { - args := m.Called() - return args.Get(0).([]string), args.Error(1) -} - -func (m *MockBanMgr) ListBannedNicknames() ([]string, error) { - args := m.Called() - return args.Get(0).([]string), args.Error(1) -} diff --git a/hotline/chat.go b/hotline/chat.go index f35fac5..00ae8ea 100644 --- a/hotline/chat.go +++ b/hotline/chat.go @@ -4,8 +4,6 @@ import ( "crypto/rand" "slices" "sync" - - "github.com/stretchr/testify/mock" ) type PrivateChat struct { @@ -101,38 +99,3 @@ func (cm *MemChatManager) SetSubject(id ChatID, subject string) { chat.Subject = subject } - -type MockChatManager struct { - mock.Mock -} - -func (m *MockChatManager) New(cc *ClientConn) ChatID { - args := m.Called(cc) - - return args.Get(0).(ChatID) -} - -func (m *MockChatManager) GetSubject(id ChatID) string { - args := m.Called(id) - - return args.String(0) -} - -func (m *MockChatManager) Join(id ChatID, cc *ClientConn) { - m.Called(id, cc) -} - -func (m *MockChatManager) Leave(id ChatID, clientID [2]byte) { - m.Called(id, clientID) -} - -func (m *MockChatManager) SetSubject(id ChatID, subject string) { - m.Called(id, subject) - -} - -func (m *MockChatManager) Members(id ChatID) []*ClientConn { - args := m.Called(id) - - return args.Get(0).([]*ClientConn) -} diff --git a/hotline/client_manager.go b/hotline/client_manager.go index 22d096d..60f0388 100644 --- a/hotline/client_manager.go +++ b/hotline/client_manager.go @@ -6,8 +6,6 @@ import ( "slices" "sync" "sync/atomic" - - "github.com/stretchr/testify/mock" ) type ClientID [2]byte @@ -19,29 +17,6 @@ type ClientManager interface { Delete(id ClientID) } -type MockClientMgr struct { - mock.Mock -} - -func (m *MockClientMgr) List() []*ClientConn { - args := m.Called() - - return args.Get(0).([]*ClientConn) -} - -func (m *MockClientMgr) Get(id ClientID) *ClientConn { - args := m.Called(id) - - return args.Get(0).(*ClientConn) -} - -func (m *MockClientMgr) Add(cc *ClientConn) { - m.Called(cc) -} -func (m *MockClientMgr) Delete(id ClientID) { - m.Called(id) -} - type MemClientMgr struct { clients map[ClientID]*ClientConn diff --git a/hotline/file_store.go b/hotline/file_store.go index 8cf1403..735ff69 100644 --- a/hotline/file_store.go +++ b/hotline/file_store.go @@ -5,9 +5,6 @@ import ( "io/fs" "os" "path/filepath" - "time" - - "github.com/stretchr/testify/mock" ) // FileStore is the storage backend for the file library (the FileRoot that clients browse, @@ -111,120 +108,3 @@ func (*OSFileStore) OpenFile(name string, flag int, perm fs.FileMode) (io.WriteC } return f, nil } - -type MockFileStore struct { - mock.Mock -} - -var _ FileStore = (*MockFileStore)(nil) - -func (mfs *MockFileStore) Mkdir(name string, perm fs.FileMode) error { - args := mfs.Called(name, perm) - return args.Error(0) -} - -func (mfs *MockFileStore) Stat(name string) (fs.FileInfo, error) { - args := mfs.Called(name) - if args.Get(0) == nil { - return nil, args.Error(1) - } - return args.Get(0).(fs.FileInfo), args.Error(1) -} - -func (mfs *MockFileStore) Open(name string) (io.ReadCloser, error) { - args := mfs.Called(name) - f, _ := args.Get(0).(io.ReadCloser) - return f, args.Error(1) -} - -func (mfs *MockFileStore) ReadDir(name string) ([]fs.DirEntry, error) { - args := mfs.Called(name) - entries, _ := args.Get(0).([]fs.DirEntry) - return entries, args.Error(1) -} - -func (mfs *MockFileStore) ReadLink(name string) (string, error) { - args := mfs.Called(name) - return args.String(0), args.Error(1) -} - -func (mfs *MockFileStore) Walk(root string, fn filepath.WalkFunc) error { - args := mfs.Called(root, fn) - return args.Error(0) -} - -func (mfs *MockFileStore) OpenFile(name string, flag int, perm fs.FileMode) (io.WriteCloser, error) { - args := mfs.Called(name, flag, perm) - f, _ := args.Get(0).(io.WriteCloser) - return f, args.Error(1) -} - -func (mfs *MockFileStore) Symlink(oldname, newname string) error { - args := mfs.Called(oldname, newname) - return args.Error(0) -} - -func (mfs *MockFileStore) RemoveAll(name string) error { - args := mfs.Called(name) - return args.Error(0) -} - -func (mfs *MockFileStore) Remove(name string) error { - args := mfs.Called(name) - return args.Error(0) -} - -func (mfs *MockFileStore) Create(name string) (io.WriteCloser, error) { - args := mfs.Called(name) - f, _ := args.Get(0).(io.WriteCloser) - return f, args.Error(1) -} - -func (mfs *MockFileStore) WriteFile(name string, data []byte, perm fs.FileMode) error { - args := mfs.Called(name, data, perm) - return args.Error(0) -} - -func (mfs *MockFileStore) Rename(oldpath, newpath string) error { - args := mfs.Called(oldpath, newpath) - return args.Error(0) -} - -func (mfs *MockFileStore) ReadFile(name string) ([]byte, error) { - args := mfs.Called(name) - return args.Get(0).([]byte), args.Error(1) -} - -type MockFileInfo struct { - mock.Mock -} - -func (mfi *MockFileInfo) Name() string { - args := mfi.Called() - return args.String(0) -} - -func (mfi *MockFileInfo) Size() int64 { - args := mfi.Called() - return args.Get(0).(int64) -} - -func (mfi *MockFileInfo) Mode() fs.FileMode { - args := mfi.Called() - return args.Get(0).(fs.FileMode) -} - -func (mfi *MockFileInfo) ModTime() time.Time { - _ = mfi.Called() - return time.Now() -} - -func (mfi *MockFileInfo) IsDir() bool { - args := mfi.Called() - return args.Bool(0) -} - -func (mfi *MockFileInfo) Sys() interface{} { - _ = mfi.Called() - return nil -} diff --git a/hotline/hltest/mocks.go b/hotline/hltest/mocks.go new file mode 100644 index 0000000..2f9b9b1 --- /dev/null +++ b/hotline/hltest/mocks.go @@ -0,0 +1,319 @@ +// Package hltest provides testify mocks for the hotline package's manager interfaces, for use by +// tests in other packages (which cannot import another package's _test.go files). Keeping them +// here rather than in the hotline package itself keeps testify out of the production dependency +// graph of importers and the mocks out of the library's API surface. +// +// The hotline package's own in-package tests cannot import this package (it would create an import +// cycle through hotline) and instead use private copies in hotline/mocks_test.go. +package hltest + +import ( + "io" + "io/fs" + "path/filepath" + "time" + + "github.com/jhalter/mobius/hotline" + "github.com/stretchr/testify/mock" +) + +type MockFileStore struct { + mock.Mock +} + +var _ hotline.FileStore = (*MockFileStore)(nil) + +func (mfs *MockFileStore) Mkdir(name string, perm fs.FileMode) error { + args := mfs.Called(name, perm) + return args.Error(0) +} + +func (mfs *MockFileStore) Stat(name string) (fs.FileInfo, error) { + args := mfs.Called(name) + if args.Get(0) == nil { + return nil, args.Error(1) + } + return args.Get(0).(fs.FileInfo), args.Error(1) +} + +func (mfs *MockFileStore) Open(name string) (io.ReadCloser, error) { + args := mfs.Called(name) + f, _ := args.Get(0).(io.ReadCloser) + return f, args.Error(1) +} + +func (mfs *MockFileStore) ReadDir(name string) ([]fs.DirEntry, error) { + args := mfs.Called(name) + entries, _ := args.Get(0).([]fs.DirEntry) + return entries, args.Error(1) +} + +func (mfs *MockFileStore) ReadLink(name string) (string, error) { + args := mfs.Called(name) + return args.String(0), args.Error(1) +} + +func (mfs *MockFileStore) Walk(root string, fn filepath.WalkFunc) error { + args := mfs.Called(root, fn) + return args.Error(0) +} + +func (mfs *MockFileStore) OpenFile(name string, flag int, perm fs.FileMode) (io.WriteCloser, error) { + args := mfs.Called(name, flag, perm) + f, _ := args.Get(0).(io.WriteCloser) + return f, args.Error(1) +} + +func (mfs *MockFileStore) Symlink(oldname, newname string) error { + args := mfs.Called(oldname, newname) + return args.Error(0) +} + +func (mfs *MockFileStore) RemoveAll(name string) error { + args := mfs.Called(name) + return args.Error(0) +} + +func (mfs *MockFileStore) Remove(name string) error { + args := mfs.Called(name) + return args.Error(0) +} + +func (mfs *MockFileStore) Create(name string) (io.WriteCloser, error) { + args := mfs.Called(name) + f, _ := args.Get(0).(io.WriteCloser) + return f, args.Error(1) +} + +func (mfs *MockFileStore) WriteFile(name string, data []byte, perm fs.FileMode) error { + args := mfs.Called(name, data, perm) + return args.Error(0) +} + +func (mfs *MockFileStore) Rename(oldpath, newpath string) error { + args := mfs.Called(oldpath, newpath) + return args.Error(0) +} + +func (mfs *MockFileStore) ReadFile(name string) ([]byte, error) { + args := mfs.Called(name) + return args.Get(0).([]byte), args.Error(1) +} + +type MockFileInfo struct { + mock.Mock +} + +var _ fs.FileInfo = (*MockFileInfo)(nil) + +func (mfi *MockFileInfo) Name() string { + args := mfi.Called() + return args.String(0) +} + +func (mfi *MockFileInfo) Size() int64 { + args := mfi.Called() + return args.Get(0).(int64) +} + +func (mfi *MockFileInfo) Mode() fs.FileMode { + args := mfi.Called() + return args.Get(0).(fs.FileMode) +} + +func (mfi *MockFileInfo) ModTime() time.Time { + _ = mfi.Called() + return time.Now() +} + +func (mfi *MockFileInfo) IsDir() bool { + args := mfi.Called() + return args.Bool(0) +} + +func (mfi *MockFileInfo) Sys() interface{} { + _ = mfi.Called() + return nil +} + +type MockClientMgr struct { + mock.Mock +} + +var _ hotline.ClientManager = (*MockClientMgr)(nil) + +func (m *MockClientMgr) List() []*hotline.ClientConn { + args := m.Called() + + return args.Get(0).([]*hotline.ClientConn) +} + +func (m *MockClientMgr) Get(id hotline.ClientID) *hotline.ClientConn { + args := m.Called(id) + + return args.Get(0).(*hotline.ClientConn) +} + +func (m *MockClientMgr) Add(cc *hotline.ClientConn) { + m.Called(cc) +} + +func (m *MockClientMgr) Delete(id hotline.ClientID) { + m.Called(id) +} + +type MockBanMgr struct { + mock.Mock +} + +var _ hotline.BanMgr = (*MockBanMgr)(nil) + +func (m *MockBanMgr) Add(ip string, until *time.Time) error { + args := m.Called(ip, until) + return args.Error(0) +} + +func (m *MockBanMgr) IsBanned(ip string) (bool, *time.Time) { + args := m.Called(ip) + return args.Bool(0), args.Get(1).(*time.Time) +} + +func (m *MockBanMgr) UnbanIP(ip string) error { + args := m.Called(ip) + return args.Error(0) +} + +func (m *MockBanMgr) BanUsername(username string) error { + args := m.Called(username) + return args.Error(0) +} + +func (m *MockBanMgr) UnbanUsername(username string) error { + args := m.Called(username) + return args.Error(0) +} + +func (m *MockBanMgr) IsUsernameBanned(username string) bool { + args := m.Called(username) + return args.Bool(0) +} + +func (m *MockBanMgr) BanNickname(nickname string) error { + args := m.Called(nickname) + return args.Error(0) +} + +func (m *MockBanMgr) UnbanNickname(nickname string) error { + args := m.Called(nickname) + return args.Error(0) +} + +func (m *MockBanMgr) IsNicknameBanned(nickname string) bool { + args := m.Called(nickname) + return args.Bool(0) +} + +func (m *MockBanMgr) ListBannedIPs() ([]string, error) { + args := m.Called() + return args.Get(0).([]string), args.Error(1) +} + +func (m *MockBanMgr) ListBannedUsernames() ([]string, error) { + args := m.Called() + return args.Get(0).([]string), args.Error(1) +} + +func (m *MockBanMgr) ListBannedNicknames() ([]string, error) { + args := m.Called() + return args.Get(0).([]string), args.Error(1) +} + +type MockChatManager struct { + mock.Mock +} + +var _ hotline.ChatManager = (*MockChatManager)(nil) + +func (m *MockChatManager) New(cc *hotline.ClientConn) hotline.ChatID { + args := m.Called(cc) + + return args.Get(0).(hotline.ChatID) +} + +func (m *MockChatManager) GetSubject(id hotline.ChatID) string { + args := m.Called(id) + + return args.String(0) +} + +func (m *MockChatManager) Join(id hotline.ChatID, cc *hotline.ClientConn) { + m.Called(id, cc) +} + +func (m *MockChatManager) Leave(id hotline.ChatID, clientID [2]byte) { + m.Called(id, clientID) +} + +func (m *MockChatManager) SetSubject(id hotline.ChatID, subject string) { + m.Called(id, subject) +} + +func (m *MockChatManager) Members(id hotline.ChatID) []*hotline.ClientConn { + args := m.Called(id) + + return args.Get(0).([]*hotline.ClientConn) +} + +type MockThreadNewsMgr struct { + mock.Mock +} + +var _ hotline.ThreadedNewsMgr = (*MockThreadNewsMgr)(nil) + +func (m *MockThreadNewsMgr) ListArticles(newsPath []string) (hotline.NewsArtListData, error) { + args := m.Called(newsPath) + + return args.Get(0).(hotline.NewsArtListData), args.Error(1) +} + +func (m *MockThreadNewsMgr) GetArticle(newsPath []string, articleID uint32) *hotline.NewsArtData { + args := m.Called(newsPath, articleID) + + return args.Get(0).(*hotline.NewsArtData) +} + +func (m *MockThreadNewsMgr) DeleteArticle(newsPath []string, articleID uint32, recursive bool) error { + args := m.Called(newsPath, articleID, recursive) + + return args.Error(0) +} + +func (m *MockThreadNewsMgr) PostArticle(newsPath []string, parentArticleID uint32, article hotline.NewsArtData) error { + args := m.Called(newsPath, parentArticleID, article) + + return args.Error(0) +} + +func (m *MockThreadNewsMgr) CreateGrouping(newsPath []string, name string, itemType [2]byte) error { + args := m.Called(newsPath, name, itemType) + + return args.Error(0) +} + +func (m *MockThreadNewsMgr) GetCategories(paths []string) []hotline.NewsCategoryListData15 { + args := m.Called(paths) + + return args.Get(0).([]hotline.NewsCategoryListData15) +} + +func (m *MockThreadNewsMgr) NewsItem(newsPath []string) hotline.NewsCategoryListData15 { + args := m.Called(newsPath) + + return args.Get(0).(hotline.NewsCategoryListData15) +} + +func (m *MockThreadNewsMgr) DeleteNewsItem(newsPath []string) error { + args := m.Called(newsPath) + + return args.Error(0) +} diff --git a/hotline/mocks_test.go b/hotline/mocks_test.go new file mode 100644 index 0000000..bd17b3b --- /dev/null +++ b/hotline/mocks_test.go @@ -0,0 +1,160 @@ +package hotline + +// In-package copies of the mocks these tests need. They cannot use hotline/hltest — importing it +// from an in-package test would create an import cycle through hotline — so the mocks used by +// in-package tests live here. Cross-package consumers use hotline/hltest instead; keep the two in +// sync (the conformance assertions in both files catch signature drift). + +import ( + "io" + "io/fs" + "path/filepath" + "time" + + "github.com/stretchr/testify/mock" +) + +type MockFileStore struct { + mock.Mock +} + +var _ FileStore = (*MockFileStore)(nil) + +func (mfs *MockFileStore) Mkdir(name string, perm fs.FileMode) error { + args := mfs.Called(name, perm) + return args.Error(0) +} + +func (mfs *MockFileStore) Stat(name string) (fs.FileInfo, error) { + args := mfs.Called(name) + if args.Get(0) == nil { + return nil, args.Error(1) + } + return args.Get(0).(fs.FileInfo), args.Error(1) +} + +func (mfs *MockFileStore) Open(name string) (io.ReadCloser, error) { + args := mfs.Called(name) + f, _ := args.Get(0).(io.ReadCloser) + return f, args.Error(1) +} + +func (mfs *MockFileStore) ReadDir(name string) ([]fs.DirEntry, error) { + args := mfs.Called(name) + entries, _ := args.Get(0).([]fs.DirEntry) + return entries, args.Error(1) +} + +func (mfs *MockFileStore) ReadLink(name string) (string, error) { + args := mfs.Called(name) + return args.String(0), args.Error(1) +} + +func (mfs *MockFileStore) Walk(root string, fn filepath.WalkFunc) error { + args := mfs.Called(root, fn) + return args.Error(0) +} + +func (mfs *MockFileStore) OpenFile(name string, flag int, perm fs.FileMode) (io.WriteCloser, error) { + args := mfs.Called(name, flag, perm) + f, _ := args.Get(0).(io.WriteCloser) + return f, args.Error(1) +} + +func (mfs *MockFileStore) Symlink(oldname, newname string) error { + args := mfs.Called(oldname, newname) + return args.Error(0) +} + +func (mfs *MockFileStore) RemoveAll(name string) error { + args := mfs.Called(name) + return args.Error(0) +} + +func (mfs *MockFileStore) Remove(name string) error { + args := mfs.Called(name) + return args.Error(0) +} + +func (mfs *MockFileStore) Create(name string) (io.WriteCloser, error) { + args := mfs.Called(name) + f, _ := args.Get(0).(io.WriteCloser) + return f, args.Error(1) +} + +func (mfs *MockFileStore) WriteFile(name string, data []byte, perm fs.FileMode) error { + args := mfs.Called(name, data, perm) + return args.Error(0) +} + +func (mfs *MockFileStore) Rename(oldpath, newpath string) error { + args := mfs.Called(oldpath, newpath) + return args.Error(0) +} + +func (mfs *MockFileStore) ReadFile(name string) ([]byte, error) { + args := mfs.Called(name) + return args.Get(0).([]byte), args.Error(1) +} + +type MockFileInfo struct { + mock.Mock +} + +var _ fs.FileInfo = (*MockFileInfo)(nil) + +func (mfi *MockFileInfo) Name() string { + args := mfi.Called() + return args.String(0) +} + +func (mfi *MockFileInfo) Size() int64 { + args := mfi.Called() + return args.Get(0).(int64) +} + +func (mfi *MockFileInfo) Mode() fs.FileMode { + args := mfi.Called() + return args.Get(0).(fs.FileMode) +} + +func (mfi *MockFileInfo) ModTime() time.Time { + _ = mfi.Called() + return time.Now() +} + +func (mfi *MockFileInfo) IsDir() bool { + args := mfi.Called() + return args.Bool(0) +} + +func (mfi *MockFileInfo) Sys() interface{} { + _ = mfi.Called() + return nil +} + +type MockClientMgr struct { + mock.Mock +} + +var _ ClientManager = (*MockClientMgr)(nil) + +func (m *MockClientMgr) List() []*ClientConn { + args := m.Called() + + return args.Get(0).([]*ClientConn) +} + +func (m *MockClientMgr) Get(id ClientID) *ClientConn { + args := m.Called(id) + + return args.Get(0).(*ClientConn) +} + +func (m *MockClientMgr) Add(cc *ClientConn) { + m.Called(cc) +} + +func (m *MockClientMgr) Delete(id ClientID) { + m.Called(id) +} diff --git a/hotline/news.go b/hotline/news.go index 5e1d6e9..033badb 100644 --- a/hotline/news.go +++ b/hotline/news.go @@ -5,8 +5,6 @@ import ( "encoding/binary" "io" "slices" - - "github.com/stretchr/testify/mock" ) var ( @@ -362,53 +360,3 @@ func newsPathScanner(data []byte, _ bool) (advance int, token []byte, err error) advance = 3 + int(data[2]) return advance, data[3:advance], nil } - -type MockThreadNewsMgr struct { - mock.Mock -} - -func (m *MockThreadNewsMgr) ListArticles(newsPath []string) (NewsArtListData, error) { - args := m.Called(newsPath) - - return args.Get(0).(NewsArtListData), args.Error(1) -} - -func (m *MockThreadNewsMgr) GetArticle(newsPath []string, articleID uint32) *NewsArtData { - args := m.Called(newsPath, articleID) - - return args.Get(0).(*NewsArtData) -} -func (m *MockThreadNewsMgr) DeleteArticle(newsPath []string, articleID uint32, recursive bool) error { - args := m.Called(newsPath, articleID, recursive) - - return args.Error(0) -} - -func (m *MockThreadNewsMgr) PostArticle(newsPath []string, parentArticleID uint32, article NewsArtData) error { - args := m.Called(newsPath, parentArticleID, article) - - return args.Error(0) -} -func (m *MockThreadNewsMgr) CreateGrouping(newsPath []string, name string, itemType [2]byte) error { - args := m.Called(newsPath, name, itemType) - - return args.Error(0) -} - -func (m *MockThreadNewsMgr) GetCategories(paths []string) []NewsCategoryListData15 { - args := m.Called(paths) - - return args.Get(0).([]NewsCategoryListData15) -} - -func (m *MockThreadNewsMgr) NewsItem(newsPath []string) NewsCategoryListData15 { - args := m.Called(newsPath) - - return args.Get(0).(NewsCategoryListData15) -} - -func (m *MockThreadNewsMgr) DeleteNewsItem(newsPath []string) error { - args := m.Called(newsPath) - - return args.Error(0) -} -- cgit