generated from mattermost/mattermost-plugin-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
1,875 additions
and
68 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 |
---|---|---|
|
@@ -165,7 +165,7 @@ apply: | |
## Install go tools | ||
install-go-tools: | ||
@echo Installing go tools | ||
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.1 | ||
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.0 | ||
$(GO) install gotest.tools/[email protected] | ||
|
||
## Runs golangci-lint and eslint. | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,7 +1,9 @@ | ||
package api | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
"time" | ||
|
||
"github.com/golang/mock/gomock" | ||
|
||
|
@@ -21,6 +23,18 @@ const ( | |
MockOption = "mockOption" | ||
MockEventID = "mockEventID" | ||
MockRemoteUserID = "mockRemoteUserID" | ||
MockChannelID = "mockChannelID" | ||
|
||
ValidRequestBodyJSON = `{ | ||
"all_day": false, | ||
"attendees": ["user1", "user2"], | ||
"date": "2024-10-17", | ||
"start_time": "10:00AM", | ||
"end_time": "11:00AM", | ||
"description": "Team sync meeting", | ||
"subject": "Team Sync", | ||
"channel_id": "mockChannelID" | ||
}` | ||
) | ||
|
||
type MockNotificationProcessor struct { | ||
|
@@ -69,3 +83,61 @@ func GetMockSetup(t *testing.T) (*api, *mock_store.MockStore, *mock_bot.MockPost | |
|
||
return api, mockStore, mockPoster, mockRemote, mockPluginAPI, mockLogger, mockLoggerWith, mockClient | ||
} | ||
|
||
// revive:disable-next-line:unexported-return | ||
func GetMockCreateEventPayload(allDay bool, attendees []string, date, startTime, endTime, description, subject, location, channelID string) createEventPayload { | ||
return createEventPayload{ | ||
AllDay: allDay, | ||
Attendees: attendees, | ||
Date: date, | ||
StartTime: startTime, | ||
EndTime: endTime, | ||
Description: description, | ||
Subject: subject, | ||
Location: location, | ||
ChannelID: channelID, | ||
} | ||
} | ||
|
||
func GetCurrentTimeRequestBodyJSON(channelID string) string { | ||
currentTime := time.Now() | ||
date := currentTime.Format("2006-01-02") | ||
startTime := currentTime.Add(time.Hour).Format("15:04") | ||
endTime := currentTime.Add(2 * time.Hour).Format("15:04") | ||
|
||
return fmt.Sprintf(`{ | ||
"all_day": false, | ||
"attendees": [], | ||
"date": "%s", | ||
"start_time": "%s", | ||
"end_time": "%s", | ||
"description": "Discuss the quarterly results.", | ||
"subject": "Meeting with team", | ||
"location": "Conference Room", | ||
"channel_id": "%s" | ||
}`, date, startTime, endTime, channelID) | ||
} | ||
|
||
func GetMockRemoteEvent() *remote.Event { | ||
currentTime := time.Now() | ||
return &remote.Event{ | ||
Start: &remote.DateTime{ | ||
DateTime: currentTime.Add(time.Hour).Format("2006-01-02T15:04:05Z"), | ||
TimeZone: "UTC", | ||
}, | ||
End: &remote.DateTime{ | ||
DateTime: currentTime.Add(2 * time.Hour).Format("2006-01-02T15:04:05Z"), | ||
TimeZone: "UTC", | ||
}, | ||
Subject: "Meeting with team", | ||
Location: &remote.Location{DisplayName: "Conference Room"}, | ||
Conference: &remote.Conference{ | ||
URL: "https://example.com/conference", | ||
Application: "Zoom", | ||
}, | ||
Attendees: []*remote.Attendee{ | ||
{EmailAddress: &remote.EmailAddress{Name: "John Doe", Address: "[email protected]"}}, | ||
{EmailAddress: &remote.EmailAddress{Name: "Jane Smith", Address: "[email protected]"}}, | ||
}, | ||
} | ||
} |
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
Oops, something went wrong.