Merge branch 'master' into mark-as-unread
Этот коммит содержится в:
@@ -27,7 +27,11 @@ jobs:
|
|||||||
git checkout $CIRCLE_BRANCH || git checkout master
|
git checkout $CIRCLE_BRANCH || git checkout master
|
||||||
export WEBAPP_GIT_COMMIT=$(git rev-parse HEAD)
|
export WEBAPP_GIT_COMMIT=$(git rev-parse HEAD)
|
||||||
echo "$WEBAPP_GIT_COMMIT"
|
echo "$WEBAPP_GIT_COMMIT"
|
||||||
curl -f -o ./dist.tar.gz https://releases.mattermost.com/mattermost-webapp/commit/${WEBAPP_GIT_COMMIT}/mattermost-webapp.tar.gz && mkdir ./dist && tar -xvf ./dist.tar.gz -C ./dist --strip-components=1 || make node_modules test build
|
curl -f -o ./dist.tar.gz https://releases.mattermost.com/mattermost-webapp/commit/${WEBAPP_GIT_COMMIT}/mattermost-webapp.tar.gz && mkdir ./dist && tar -xvf ./dist.tar.gz -C ./dist --strip-components=1 || echo "curl failed" && export CURL_FAILED=1
|
||||||
|
if [ $CURL_FAILED -eq 1 ]
|
||||||
|
then
|
||||||
|
npm ci && cd node_modules/mattermost-redux && npm install && npm run build && cd ../.. && make build
|
||||||
|
fi
|
||||||
- persist_to_workspace:
|
- persist_to_workspace:
|
||||||
root: /go/src/github.com/mattermost
|
root: /go/src/github.com/mattermost
|
||||||
paths:
|
paths:
|
||||||
|
|||||||
2
Makefile
2
Makefile
@@ -89,7 +89,7 @@ PLUGIN_PACKAGES += mattermost-plugin-github-v0.11.0
|
|||||||
PLUGIN_PACKAGES += mattermost-plugin-welcomebot-v1.1.1
|
PLUGIN_PACKAGES += mattermost-plugin-welcomebot-v1.1.1
|
||||||
PLUGIN_PACKAGES += mattermost-plugin-aws-SNS-v1.0.2
|
PLUGIN_PACKAGES += mattermost-plugin-aws-SNS-v1.0.2
|
||||||
PLUGIN_PACKAGES += mattermost-plugin-antivirus-v0.1.1
|
PLUGIN_PACKAGES += mattermost-plugin-antivirus-v0.1.1
|
||||||
PLUGIN_PACKAGES += mattermost-plugin-jira-v2.2.0
|
PLUGIN_PACKAGES += mattermost-plugin-jira-v2.2.1
|
||||||
PLUGIN_PACKAGES += mattermost-plugin-gitlab-v1.0.0
|
PLUGIN_PACKAGES += mattermost-plugin-gitlab-v1.0.0
|
||||||
PLUGIN_PACKAGES += mattermost-plugin-jenkins-v1.0.0
|
PLUGIN_PACKAGES += mattermost-plugin-jenkins-v1.0.0
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/mattermost/mattermost-server/model"
|
"github.com/mattermost/mattermost-server/model"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSaveStatus(t *testing.T) {
|
func TestSaveStatus(t *testing.T) {
|
||||||
@@ -30,11 +31,8 @@ func TestSaveStatus(t *testing.T) {
|
|||||||
th.App.SaveAndBroadcastStatus(status)
|
th.App.SaveAndBroadcastStatus(status)
|
||||||
|
|
||||||
after, err := th.App.GetStatus(user.Id)
|
after, err := th.App.GetStatus(user.Id)
|
||||||
if err != nil {
|
require.Nil(t, err, "failed to get status after save: %v", err)
|
||||||
t.Fatalf("failed to get status after save: %v", err)
|
require.Equal(t, statusString, after.Status, "failed to save status, got %v, expected %v", after.Status, statusString)
|
||||||
} else if after.Status != statusString {
|
|
||||||
t.Fatalf("failed to save status, got %v, expected %v", after.Status, statusString)
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,22 +16,10 @@ func TestStatus(t *testing.T) {
|
|||||||
json := status.ToJson()
|
json := status.ToJson()
|
||||||
status2 := StatusFromJson(strings.NewReader(json))
|
status2 := StatusFromJson(strings.NewReader(json))
|
||||||
|
|
||||||
if status.UserId != status2.UserId {
|
assert.Equal(t, status.UserId, status2.UserId, "UserId should have matched")
|
||||||
t.Fatal("UserId should have matched")
|
assert.Equal(t, status.Status, status2.Status, "Status should have matched")
|
||||||
}
|
assert.Equal(t, status.LastActivityAt, status2.LastActivityAt, "LastActivityAt should have matched")
|
||||||
|
assert.Equal(t, status.Manual, status2.Manual, "Manual should have matched")
|
||||||
if status.Status != status2.Status {
|
|
||||||
t.Fatal("Status should have matched")
|
|
||||||
}
|
|
||||||
|
|
||||||
if status.LastActivityAt != status2.LastActivityAt {
|
|
||||||
t.Fatal("LastActivityAt should have matched")
|
|
||||||
}
|
|
||||||
|
|
||||||
if status.Manual != status2.Manual {
|
|
||||||
t.Fatal("Manual should have matched")
|
|
||||||
}
|
|
||||||
|
|
||||||
assert.Equal(t, "", status2.ActiveChannel)
|
assert.Equal(t, "", status2.ActiveChannel)
|
||||||
|
|
||||||
json = status.ToClusterJson()
|
json = status.ToClusterJson()
|
||||||
@@ -70,10 +58,6 @@ func TestStatusListFromJson(t *testing.T) {
|
|||||||
toDec := strings.NewReader(jsonStream)
|
toDec := strings.NewReader(jsonStream)
|
||||||
statusesFromJson := StatusListFromJson(toDec)
|
statusesFromJson := StatusListFromJson(toDec)
|
||||||
|
|
||||||
if statusesFromJson[0].UserId != dat[0]["user_id"] {
|
assert.Equal(t, statusesFromJson[0].UserId, dat[0]["user_id"], "UserId should be equal")
|
||||||
t.Fatal("UserId should be equal")
|
assert.Equal(t, statusesFromJson[1].UserId, dat[1]["user_id"], "UserId should be equal")
|
||||||
}
|
|
||||||
if statusesFromJson[1].UserId != dat[1]["user_id"] {
|
|
||||||
t.Fatal("UserId should be equal")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ package model
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestTeamJson(t *testing.T) {
|
func TestTeamJson(t *testing.T) {
|
||||||
@@ -13,56 +16,46 @@ func TestTeamJson(t *testing.T) {
|
|||||||
json := o.ToJson()
|
json := o.ToJson()
|
||||||
ro := TeamFromJson(strings.NewReader(json))
|
ro := TeamFromJson(strings.NewReader(json))
|
||||||
|
|
||||||
if o.Id != ro.Id {
|
require.Equal(t, o.Id, ro.Id, "Ids do not match")
|
||||||
t.Fatal("Ids do not match")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTeamIsValid(t *testing.T) {
|
func TestTeamIsValid(t *testing.T) {
|
||||||
o := Team{}
|
o := Team{}
|
||||||
|
|
||||||
if err := o.IsValid(); err == nil {
|
err := o.IsValid()
|
||||||
t.Fatal("should be invalid")
|
require.NotNil(t, err, "should be invalid")
|
||||||
}
|
|
||||||
|
|
||||||
o.Id = NewId()
|
o.Id = NewId()
|
||||||
if err := o.IsValid(); err == nil {
|
err = o.IsValid()
|
||||||
t.Fatal("should be invalid")
|
require.NotNil(t, err, "should be invalid")
|
||||||
}
|
|
||||||
|
|
||||||
o.CreateAt = GetMillis()
|
o.CreateAt = GetMillis()
|
||||||
if err := o.IsValid(); err == nil {
|
err = o.IsValid()
|
||||||
t.Fatal("should be invalid")
|
require.NotNil(t, err, "should be invalid")
|
||||||
}
|
|
||||||
|
|
||||||
o.UpdateAt = GetMillis()
|
o.UpdateAt = GetMillis()
|
||||||
if err := o.IsValid(); err == nil {
|
err = o.IsValid()
|
||||||
t.Fatal("should be invalid")
|
require.NotNil(t, err, "should be invalid")
|
||||||
}
|
|
||||||
|
|
||||||
o.Email = strings.Repeat("01234567890", 20)
|
o.Email = strings.Repeat("01234567890", 20)
|
||||||
if err := o.IsValid(); err == nil {
|
err = o.IsValid()
|
||||||
t.Fatal("should be invalid")
|
require.NotNil(t, err, "should be invalid")
|
||||||
}
|
|
||||||
|
|
||||||
o.Email = "corey+test@hulen.com"
|
o.Email = "corey+test@hulen.com"
|
||||||
o.DisplayName = strings.Repeat("01234567890", 20)
|
o.DisplayName = strings.Repeat("01234567890", 20)
|
||||||
if err := o.IsValid(); err == nil {
|
err = o.IsValid()
|
||||||
t.Fatal("should be invalid")
|
require.NotNil(t, err, "should be invalid")
|
||||||
}
|
|
||||||
|
|
||||||
o.DisplayName = "1234"
|
o.DisplayName = "1234"
|
||||||
o.Name = "ZZZZZZZ"
|
o.Name = "ZZZZZZZ"
|
||||||
if err := o.IsValid(); err == nil {
|
err = o.IsValid()
|
||||||
t.Fatal("should be invalid")
|
require.NotNil(t, err, "should be invalid")
|
||||||
}
|
|
||||||
|
|
||||||
o.Name = "zzzzz"
|
o.Name = "zzzzz"
|
||||||
o.Type = TEAM_OPEN
|
o.Type = TEAM_OPEN
|
||||||
o.InviteId = NewId()
|
o.InviteId = NewId()
|
||||||
if err := o.IsValid(); err != nil {
|
err = o.IsValid()
|
||||||
t.Fatal(err)
|
require.Nil(t, err, err)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTeamPreSave(t *testing.T) {
|
func TestTeamPreSave(t *testing.T) {
|
||||||
@@ -95,9 +88,8 @@ var domains = []struct {
|
|||||||
|
|
||||||
func TestValidTeamName(t *testing.T) {
|
func TestValidTeamName(t *testing.T) {
|
||||||
for _, v := range domains {
|
for _, v := range domains {
|
||||||
if IsValidTeamName(v.value) != v.expected {
|
actual := IsValidTeamName(v.value)
|
||||||
t.Errorf("expect %v as %v", v.value, v.expected)
|
assert.Equal(t, v.expected, actual)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,24 +104,20 @@ var tReservedDomains = []struct {
|
|||||||
|
|
||||||
func TestReservedTeamName(t *testing.T) {
|
func TestReservedTeamName(t *testing.T) {
|
||||||
for _, v := range tReservedDomains {
|
for _, v := range tReservedDomains {
|
||||||
if IsReservedTeamName(v.value) != v.expected {
|
actual := IsReservedTeamName(v.value)
|
||||||
t.Errorf("expect %v as %v", v.value, v.expected)
|
assert.Equal(t, v.expected, actual)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCleanTeamName(t *testing.T) {
|
func TestCleanTeamName(t *testing.T) {
|
||||||
if CleanTeamName("Jimbo's Admin") != "jimbos-admin" {
|
actual := CleanTeamName("Jimbo's Admin")
|
||||||
t.Fatal("didn't clean name properly")
|
require.Equal(t, "jimbos-admin", actual, "didn't clean name properly")
|
||||||
}
|
|
||||||
|
|
||||||
if CleanTeamName("Admin Really cool") != "really-cool" {
|
actual = CleanTeamName("Admin Really cool")
|
||||||
t.Fatal("didn't clean name properly")
|
require.Equal(t, "really-cool", actual, "didn't clean name properly")
|
||||||
}
|
|
||||||
|
|
||||||
if CleanTeamName("super-duper-guys") != "super-duper-guys" {
|
actual = CleanTeamName("super-duper-guys")
|
||||||
t.Fatal("didn't clean name properly")
|
require.Equal(t, "super-duper-guys", actual, "didn't clean name properly")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestTeamPatch(t *testing.T) {
|
func TestTeamPatch(t *testing.T) {
|
||||||
@@ -152,22 +140,10 @@ func TestTeamPatch(t *testing.T) {
|
|||||||
o := Team{Id: NewId()}
|
o := Team{Id: NewId()}
|
||||||
o.Patch(p)
|
o.Patch(p)
|
||||||
|
|
||||||
if *p.DisplayName != o.DisplayName {
|
require.Equal(t, *p.DisplayName, o.DisplayName, "DisplayName did not update")
|
||||||
t.Fatal("DisplayName did not update")
|
require.Equal(t, *p.Description, o.Description, "Description did not update")
|
||||||
}
|
require.Equal(t, *p.CompanyName, o.CompanyName, "CompanyName did not update")
|
||||||
if *p.Description != o.Description {
|
require.Equal(t, *p.AllowedDomains, o.AllowedDomains, "AllowedDomains did not update")
|
||||||
t.Fatal("Description did not update")
|
require.Equal(t, *p.AllowOpenInvite, o.AllowOpenInvite, "AllowOpenInvite did not update")
|
||||||
}
|
require.Equal(t, *p.GroupConstrained, *o.GroupConstrained)
|
||||||
if *p.CompanyName != o.CompanyName {
|
|
||||||
t.Fatal("CompanyName did not update")
|
|
||||||
}
|
|
||||||
if *p.AllowedDomains != o.AllowedDomains {
|
|
||||||
t.Fatal("AllowedDomains did not update")
|
|
||||||
}
|
|
||||||
if *p.AllowOpenInvite != o.AllowOpenInvite {
|
|
||||||
t.Fatal("AllowOpenInvite did not update")
|
|
||||||
}
|
|
||||||
if *p.GroupConstrained != *o.GroupConstrained {
|
|
||||||
t.Fatalf("expected %v got %v", *p.GroupConstrained, *o.GroupConstrained)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user