diff options
author | Chris <ccbrown112@gmail.com> | 2017-08-28 14:19:00 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-28 14:19:00 -0500 |
commit | ff50b0e1382ba0214300ffb8eb467a78dae5b803 (patch) | |
tree | 4f11789e8b222a42d9074c46341fff6090b313d2 /plugin/plugintest/api.go | |
parent | 6215c9159acb85033616d2937edf3d87ef7ca79b (diff) | |
download | chat-ff50b0e1382ba0214300ffb8eb467a78dae5b803.tar.gz chat-ff50b0e1382ba0214300ffb8eb467a78dae5b803.tar.bz2 chat-ff50b0e1382ba0214300ffb8eb467a78dae5b803.zip |
add client4 apis needed for jira plugin (#7292)
Diffstat (limited to 'plugin/plugintest/api.go')
-rw-r--r-- | plugin/plugintest/api.go | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/plugin/plugintest/api.go b/plugin/plugintest/api.go index 2f1db88cf..6555a966c 100644 --- a/plugin/plugintest/api.go +++ b/plugin/plugintest/api.go @@ -3,6 +3,7 @@ package plugintest import ( "github.com/stretchr/testify/mock" + "github.com/mattermost/platform/model" "github.com/mattermost/platform/plugin" ) @@ -15,3 +16,43 @@ var _ plugin.API = (*API)(nil) func (m *API) LoadPluginConfiguration(dest interface{}) error { return m.Called(dest).Error(0) } + +func (m *API) GetTeamByName(name string) (*model.Team, *model.AppError) { + ret := m.Called(name) + if f, ok := ret.Get(0).(func(string) (*model.Team, *model.AppError)); ok { + return f(name) + } + team, _ := ret.Get(0).(*model.Team) + err, _ := ret.Get(1).(*model.AppError) + return team, err +} + +func (m *API) GetUserByUsername(name string) (*model.User, *model.AppError) { + ret := m.Called(name) + if f, ok := ret.Get(0).(func(string) (*model.User, *model.AppError)); ok { + return f(name) + } + user, _ := ret.Get(0).(*model.User) + err, _ := ret.Get(1).(*model.AppError) + return user, err +} + +func (m *API) GetChannelByName(name, teamId string) (*model.Channel, *model.AppError) { + ret := m.Called(name, teamId) + if f, ok := ret.Get(0).(func(_, _ string) (*model.Channel, *model.AppError)); ok { + return f(name, teamId) + } + channel, _ := ret.Get(0).(*model.Channel) + err, _ := ret.Get(1).(*model.AppError) + return channel, err +} + +func (m *API) CreatePost(post *model.Post) (*model.Post, *model.AppError) { + ret := m.Called(post) + if f, ok := ret.Get(0).(func(*model.Post) (*model.Post, *model.AppError)); ok { + return f(post) + } + postOut, _ := ret.Get(0).(*model.Post) + err, _ := ret.Get(1).(*model.AppError) + return postOut, err +} |