-
Notifications
You must be signed in to change notification settings - Fork 9
/
dataset_test.go
50 lines (37 loc) · 1009 Bytes
/
dataset_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
46
47
48
49
50
package honeycombio
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestDatasets(t *testing.T) {
ctx := context.Background()
c := newTestClient(t)
datasetName := testDataset(t)
currentDataset := &Dataset{
Name: datasetName,
Slug: urlEncodeDataset(datasetName),
}
t.Run("List", func(t *testing.T) {
d, err := c.Datasets.List(ctx)
assert.NoError(t, err)
assert.Contains(t, d, *currentDataset, "could not find current dataset with List")
})
t.Run("Get", func(t *testing.T) {
d, err := c.Datasets.Get(ctx, currentDataset.Slug)
assert.NoError(t, err)
assert.Equal(t, *currentDataset, *d)
})
t.Run("Get_notFound", func(t *testing.T) {
_, err := c.Datasets.Get(ctx, "does-not-exist")
assert.Equal(t, ErrNotFound, err)
})
t.Run("Create", func(t *testing.T) {
createDataset := &Dataset{
Name: "kvrhdn/go-honeycombio",
}
d, err := c.Datasets.Create(ctx, createDataset)
assert.NoError(t, err)
assert.Equal(t, currentDataset, d)
})
}