diff options
Diffstat (limited to 'model/oauth_test.go')
-rw-r--r-- | model/oauth_test.go | 42 |
1 files changed, 12 insertions, 30 deletions
diff --git a/model/oauth_test.go b/model/oauth_test.go index 5c0547717..cbed8a633 100644 --- a/model/oauth_test.go +++ b/model/oauth_test.go @@ -6,6 +6,8 @@ package model import ( "strings" "testing" + + "github.com/stretchr/testify/require" ) func TestOAuthAppJson(t *testing.T) { @@ -52,52 +54,32 @@ func TestOAuthAppPreUpdate(t *testing.T) { func TestOAuthAppIsValid(t *testing.T) { app := OAuthApp{} - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.Id = NewId() - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.CreateAt = 1 - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.UpdateAt = 1 - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.CreatorId = NewId() - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.ClientSecret = NewId() - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.Name = "TestOAuthApp" - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.CallbackUrls = []string{"https://nowhere.com"} - if err := app.IsValid(); err == nil { - t.Fatal() - } + require.NotNil(t, app.IsValid()) app.Homepage = "https://nowhere.com" - if err := app.IsValid(); err != nil { - t.Fatal() - } + require.Nil(t, app.IsValid()) app.IconURL = "https://nowhere.com/icon_image.png" - if err := app.IsValid(); err != nil { - t.Fatal() - } + require.Nil(t, app.IsValid()) } |