-
Notifications
You must be signed in to change notification settings - Fork 38
/
attachable_test.go
35 lines (28 loc) · 972 Bytes
/
attachable_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
package quickbooks
import (
"encoding/json"
"io/ioutil"
"os"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestAttachable(t *testing.T) {
jsonFile, err := os.Open("data/testing/attachable.json")
require.NoError(t, err)
defer jsonFile.Close()
byteValue, err := ioutil.ReadAll(jsonFile)
require.NoError(t, err)
var r struct {
Attachable Attachable
Time Date
}
require.NoError(t, json.Unmarshal(byteValue, &r))
assert.Equal(t, "0", r.Attachable.SyncToken)
assert.False(t, r.Attachable.AttachableRef[0].IncludeOnSend)
assert.Equal(t, "95", r.Attachable.AttachableRef[0].EntityRef.Value)
assert.Equal(t, "This is an attached note.", r.Attachable.Note)
assert.Equal(t, "200900000000000008541", r.Attachable.Id)
assert.Equal(t, "2015-11-17T11:05:15-08:00", r.Attachable.MetaData.CreateTime.String())
assert.Equal(t, "2015-11-17T11:05:15-08:00", r.Attachable.MetaData.LastUpdatedTime.String())
}