v8.0 module release (#22975)
https://mattermost.atlassian.net/browse/MM-52079 ```release-note We upgrade the module version to 8.0. The new module path is github.com/mattermost-server/server/v8. ``` Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
831ea38f7e
Коммит
b200a07881
83
server/model/authorize_test.go
Обычный файл
83
server/model/authorize_test.go
Обычный файл
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
package model
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestAuthPreSave(t *testing.T) {
|
||||
a1 := AuthData{}
|
||||
a1.ClientId = NewId()
|
||||
a1.UserId = NewId()
|
||||
a1.Code = NewId()
|
||||
a1.PreSave()
|
||||
a1.IsExpired()
|
||||
}
|
||||
|
||||
func TestAuthIsValid(t *testing.T) {
|
||||
|
||||
ad := AuthData{}
|
||||
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.ClientId = NewRandomString(28)
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed Client Id")
|
||||
|
||||
ad.ClientId = NewId()
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.UserId = NewRandomString(28)
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed User Id")
|
||||
|
||||
ad.UserId = NewId()
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.Code = NewRandomString(129)
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed Code to long")
|
||||
|
||||
ad.Code = ""
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed Code not set")
|
||||
|
||||
ad.Code = NewId()
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.ExpiresIn = 0
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed invalid ExpiresIn")
|
||||
|
||||
ad.ExpiresIn = 1
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.CreateAt = 0
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed Invalid Create At")
|
||||
|
||||
ad.CreateAt = 1
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.State = NewRandomString(129)
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed invalid State")
|
||||
|
||||
ad.State = NewRandomString(128)
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.Scope = NewRandomString(1025)
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed invalid Scope")
|
||||
|
||||
ad.Scope = NewRandomString(128)
|
||||
require.NotNil(t, ad.IsValid())
|
||||
|
||||
ad.RedirectUri = ""
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed Redirect URI not set")
|
||||
|
||||
ad.RedirectUri = NewRandomString(28)
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed invalid URL")
|
||||
|
||||
ad.RedirectUri = NewRandomString(257)
|
||||
require.NotNil(t, ad.IsValid(), "Should have failed invalid URL")
|
||||
|
||||
ad.RedirectUri = "http://example.com"
|
||||
require.Nil(t, ad.IsValid())
|
||||
}
|
||||
Ссылка в новой задаче
Block a user