generated from mattermost/mattermost-plugin-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tee log to admins as bot messages (#9)
* Added tee log to admins as bot messages Cleanup * Merged ./cicrleci from more current plugins * PR feedback
- Loading branch information
Showing
29 changed files
with
509 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,52 @@ | ||
version: 2.1 | ||
executors: | ||
default: | ||
docker: | ||
- image: circleci/golang:1.12-node | ||
|
||
jobs: | ||
lint: | ||
executor: | ||
name: default | ||
steps: | ||
- checkout | ||
- run: make check-style | ||
|
||
test: | ||
executor: | ||
name: default | ||
steps: | ||
- checkout | ||
- run: make test | ||
orbs: | ||
plugin-ci: mattermost/plugin-ci@volatile | ||
|
||
workflows: | ||
version: 2 | ||
untagged-build: | ||
ci: | ||
jobs: | ||
- lint | ||
- test | ||
- plugin-ci/lint: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
- plugin-ci/coverage: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
- plugin-ci/build: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
- plugin-ci/deploy-ci: | ||
filters: | ||
branches: | ||
only: master | ||
context: plugin-ci | ||
requires: | ||
- plugin-ci/lint | ||
- plugin-ci/coverage | ||
- plugin-ci/build | ||
- plugin-ci/deploy-release: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
context: plugin-ci | ||
requires: | ||
- plugin-ci/lint | ||
- plugin-ci/coverage | ||
- plugin-ci/build | ||
- plugin-ci/deploy-release-github: | ||
filters: | ||
tags: | ||
only: /^v.*/ | ||
branches: | ||
ignore: /.*/ | ||
context: matterbuild-github-token | ||
requires: | ||
- plugin-ci/lint | ||
- plugin-ci/coverage | ||
- plugin-ci/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ package http | |
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"net/http" | ||
"net/url" | ||
"testing" | ||
|
@@ -17,7 +16,7 @@ import ( | |
"github.com/mattermost/mattermost-plugin-msoffice/server/remote" | ||
"github.com/mattermost/mattermost-plugin-msoffice/server/remote/msgraph" | ||
"github.com/mattermost/mattermost-plugin-msoffice/server/store/mock_store" | ||
"github.com/mattermost/mattermost-plugin-msoffice/server/utils" | ||
"github.com/mattermost/mattermost-plugin-msoffice/server/utils/bot" | ||
"github.com/mattermost/mattermost-plugin-msoffice/server/utils/bot/mock_bot" | ||
) | ||
|
||
|
@@ -121,9 +120,11 @@ func TestOAuth2Complete(t *testing.T) { | |
|
||
us.EXPECT().StoreUser(gomock.Any()).Return(nil).Times(1) | ||
ss.EXPECT().VerifyOAuth2State(gomock.Eq("[email protected]")).Return(nil).Times(1) | ||
poster.EXPECT().PostDirectf( | ||
gomock.Eq("[email protected]"), gomock.Eq(getBotPosterMessage("displayName-value"))). | ||
Return(nil).Times(1) | ||
poster.EXPECT().DM( | ||
gomock.Eq("[email protected]"), | ||
gomock.Eq(api.WelcomeMessage), | ||
gomock.Eq("displayName-value"), | ||
).Return(nil).Times(1) | ||
}, | ||
expectedHTTPCode: http.StatusOK, | ||
expectedHTTPResponse: ` | ||
|
@@ -160,7 +161,7 @@ func TestOAuth2Complete(t *testing.T) { | |
} | ||
|
||
dependencies := mock_api.NewMockDependencies(ctrl) | ||
dependencies.Remote = remote.Makers[msgraph.Kind](conf, utils.NilLogger) | ||
dependencies.Remote = remote.Makers[msgraph.Kind](conf, &bot.NilLogger{}) | ||
if tc.setup != nil { | ||
tc.setup(dependencies) | ||
} | ||
|
@@ -260,12 +261,6 @@ func statusOKGraphAPIResponder() { | |
httpmock.RegisterResponder("GET", meRequestURL, meResponder) | ||
} | ||
|
||
func getBotPosterMessage(displayName string) string { | ||
return fmt.Sprintf("### Welcome to the Microsoft Office plugin!\n"+ | ||
"Here is some info to prove we got you logged in\n"+ | ||
"Name: %s \n", displayName) | ||
} | ||
|
||
func newHTTPRequest(apiconf api.Config, mattermostUserID, rawQuery string) *http.Request { | ||
r := &http.Request{ | ||
Header: make(http.Header), | ||
|
Oops, something went wrong.