github.com/gigforks/mattermost-server@v4.9.1-0.20180619094218-800d97fa55d0+incompatible/model/audits_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 11 func TestAuditsJson(t *testing.T) { 12 audit := Audit{Id: NewId(), UserId: NewId(), CreateAt: GetMillis()} 13 json := audit.ToJson() 14 result := AuditFromJson(strings.NewReader(json)) 15 16 if audit.Id != result.Id { 17 t.Fatal("Ids do not match") 18 } 19 20 var audits Audits = make([]Audit, 1) 21 audits[0] = audit 22 23 ljson := audits.ToJson() 24 results := AuditsFromJson(strings.NewReader(ljson)) 25 26 if audits[0].Id != results[0].Id { 27 t.Fatal("Ids do not match") 28 } 29 }