Files
mattermost/model/user_terms_of_Service_test.go
Jesús Espino 6b388871a9 Replacing require.nil in model package (#16953)
* Replacing require.nil in model package

* Fixing tests

* Update model/file_info_test.go

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>

* Update model/file_info_test.go

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>

Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2021-02-24 11:09:52 +01:00

40 lines
898 B
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestUserTermsOfServiceIsValid(t *testing.T) {
s := UserTermsOfService{}
require.NotNil(t, s.IsValid(), "should be invalid")
s.UserId = NewId()
require.NotNil(t, s.IsValid(), "should be invalid")
s.TermsOfServiceId = NewId()
require.NotNil(t, s.IsValid(), "should be invalid")
s.CreateAt = GetMillis()
require.Nil(t, s.IsValid(), "should be valid")
}
func TestUserTermsOfServiceJson(t *testing.T) {
o := UserTermsOfService{
UserId: NewId(),
TermsOfServiceId: NewId(),
CreateAt: GetMillis(),
}
j := o.ToJson()
ro := UserTermsOfServiceFromJson(strings.NewReader(j))
assert.NotNil(t, ro)
assert.Equal(t, o, *ro)
}