forked from SierraSoftworks/sentry-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathservername_test.go
45 lines (38 loc) · 1.02 KB
/
servername_test.go
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
44
45
package sentry
import (
"encoding/json"
"testing"
. "github.com/smartystreets/goconvey/convey"
)
func ExampleServerName() {
cl := NewClient(
// You can set the logger when you create your client
ServerName("web01"),
)
cl.Capture(
// You can also specify it when sending an event
ServerName("web01.prod"),
)
}
func TestServerName(t *testing.T) {
Convey("ServerName", t, func() {
Convey("Should register itself with the default providers", func() {
opt := testGetOptionsProvider(ServerName(""))
So(opt, ShouldNotBeNil)
})
Convey("ServerName()", func() {
Convey("Should use the correct Class()", func() {
So(ServerName("test").Class(), ShouldEqual, "server_name")
})
Convey("MarshalJSON", func() {
Convey("Should marshal to a string", func() {
Convey("Should marshal to a string", func() {
b, err := json.Marshal(ServerName("test"))
So(err, ShouldBeNil)
So(string(b), ShouldEqual, `"test"`)
})
})
})
})
})
}