github.com/mattermosttest/mattermost-server/v5@v5.0.0-20200917143240-9dfa12e121f9/model/audit_test.go (about) 1 // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. 2 // See LICENSE.txt for license information. 3 4 package model 5 6 import ( 7 "strings" 8 "testing" 9 10 "github.com/stretchr/testify/require" 11 ) 12 13 func TestAuditJson(t *testing.T) { 14 audit := Audit{Id: NewId(), UserId: NewId(), CreateAt: GetMillis()} 15 json := audit.ToJson() 16 result := AuditFromJson(strings.NewReader(json)) 17 require.Equal(t, audit.Id, result.Id, "Ids do not match") 18 }