-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapi_document_class_test.go
58 lines (49 loc) · 1.64 KB
/
api_document_class_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
51
52
53
54
55
56
57
58
package squeeze_go_client
import (
"github.com/dexpro-solutions-gmbh/squeeze-go-client/internal"
"github.com/stretchr/testify/assert"
"testing"
)
func TestDocumentClassApi_GetDocumentClasses(t *testing.T) {
c := NewClient(internal.GetEnvVal("SQZ_BASE_PATH"))
c.ApiKey = internal.GetEnvApiKey(t)
classes, e := c.DocumentClass.GetDocumentClasses()
assert.Nil(t, e)
assert.NotNil(t, classes)
assert.NotEmpty(t, classes)
}
func TestDocumentClassApi_GetAllFieldGroups(t *testing.T) {
c := NewClient(internal.GetEnvVal("SQZ_BASE_PATH"))
c.ApiKey = internal.GetEnvApiKey(t)
classes, e := c.DocumentClass.GetAllFieldGroups(1)
assert.Nil(t, e)
assert.NotNil(t, classes)
assert.NotEmpty(t, classes)
}
func TestDocumentClassApi_GetAllDocumentClassFields(t *testing.T) {
c := NewClient(internal.GetEnvVal("SQZ_BASE_PATH"))
c.ApiKey = internal.GetEnvApiKey(t)
fields, e := c.DocumentClass.GetAllDocumentClassFields(1)
assert.Nil(t, e)
assert.NotNil(t, fields)
assert.NotEmpty(t, fields)
}
// TestDocumentClassApi_Tables tests multiple endpoints related to tables
func TestDocumentClassApi_Tables(t *testing.T) {
c := NewClient(internal.GetEnvVal("SQZ_BASE_PATH"))
c.ApiKey = internal.GetEnvApiKey(t)
tableId := 0
t.Run("GetAllDocumentClassTables", func(t *testing.T) {
tables, e := c.DocumentClass.GetAllDocumentClassTables(1)
assert.Nil(t, e)
assert.NotNil(t, tables)
assert.NotEmpty(t, tables)
tableId = tables[0].Id
})
t.Run("GetAllDocumentClassTableColumns", func(t *testing.T) {
columns, e := c.DocumentClass.GetAllDocumentClassTableColumns(1, tableId)
assert.Nil(t, e)
assert.NotNil(t, columns)
assert.NotEmpty(t, columns)
})
}