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