testify model/user_terms_of_Service test (#12639)

Этот коммит содержится в:
Romain Maneschi
2019-10-11 15:06:11 +02:00
коммит произвёл Jesús Espino
родитель b56ce0e67a
Коммит f7a8d63cd0

Просмотреть файл

@@ -8,29 +8,21 @@ import (
"testing" "testing"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
) )
func TestUserTermsOfServiceIsValid(t *testing.T) { func TestUserTermsOfServiceIsValid(t *testing.T) {
s := UserTermsOfService{} s := UserTermsOfService{}
require.Error(t, s.IsValid(), "should be invalid")
if err := s.IsValid(); err == nil {
t.Fatal("should be invalid")
}
s.UserId = NewId() s.UserId = NewId()
if err := s.IsValid(); err == nil { require.Error(t, s.IsValid(), "should be invalid")
t.Fatal("should be invalid")
}
s.TermsOfServiceId = NewId() s.TermsOfServiceId = NewId()
if err := s.IsValid(); err == nil { require.Error(t, s.IsValid(), "should be invalid")
t.Fatal("should be invalid")
}
s.CreateAt = GetMillis() s.CreateAt = GetMillis()
if err := s.IsValid(); err != nil { require.Nil(t, s.IsValid(), "should be valid")
t.Fatal("should be valid")
}
} }
func TestUserTermsOfServiceJson(t *testing.T) { func TestUserTermsOfServiceJson(t *testing.T) {