blob: eac07c64680d42fb21919a56fd6237d6097df548 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (c) 2015 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package model
import (
"strings"
"testing"
)
func TestTeamMemberJson(t *testing.T) {
o := TeamMember{TeamId: NewId(), UserId: NewId()}
json := o.ToJson()
ro := TeamMemberFromJson(strings.NewReader(json))
if o.TeamId != ro.TeamId {
t.Fatal("Ids do not match")
}
}
func TestTeamMemberIsValid(t *testing.T) {
o := TeamMember{}
if err := o.IsValid(); err == nil {
t.Fatal("should be invalid")
}
o.TeamId = NewId()
if err := o.IsValid(); err == nil {
t.Fatal("should be invalid")
}
/*o.UserId = NewId()
o.Roles = "blahblah"
if err := o.IsValid(); err == nil {
t.Fatal("should be invalid")
}
o.Roles = ""
if err := o.IsValid(); err != nil {
t.Fatal(err)
}*/
}
|