forked from michaeldcanady/servicenow-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnow_request_builder_test.go
64 lines (48 loc) · 1.75 KB
/
now_request_builder_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
59
60
61
62
63
64
package servicenowsdkgo
import (
"testing"
"github.com/hdisysteme/servicenow-sdk-go/internal"
"github.com/stretchr/testify/assert"
)
func TestNewNowRequestBuilder(t *testing.T) {
client := &ServiceNowClient{} // Replace with your client implementation
url := "https://example.service-now.com/api"
builder := NewNowRequestBuilder(url, client)
expected := map[string]string{
internal.BasePathParameter: url,
}
assert.NotNil(t, builder)
assert.Equal(t, expected, builder.RequestBuilder.PathParameters)
}
func TestNowRequestBuilderTable(t *testing.T) {
client := &ServiceNowClient{} // Replace with your client implementation
url := "https://example.service-now.com/api"
builder := NewNowRequestBuilder(url, client)
tableName := "incident"
expected := map[string]string{
internal.BasePathParameter: url,
"table": tableName,
}
tableBuilder := builder.Table(tableName)
assert.NotNil(t, tableBuilder)
assert.Equal(t, expected, tableBuilder.RequestBuilder.PathParameters)
}
func TestNowRequestBuilderTable2(t *testing.T) {
client := &ServiceNowClient{} // Replace with your client implementation
url := "https://example.service-now.com/api"
builder := NewNowRequestBuilder(url, client)
tableName := "incident"
tableBuilder := builder.Table2(tableName)
assert.NotNil(t, tableBuilder)
}
func TestNowRequestBuilderAttachment(t *testing.T) {
client := &ServiceNowClient{} // Replace with your client implementation
url := "https://example.service-now.com/api"
builder := NewNowRequestBuilder(url, client)
expected := map[string]string{
internal.BasePathParameter: url,
}
attachmentBuilder := builder.Attachment()
assert.NotNil(t, attachmentBuilder)
assert.Equal(t, expected, attachmentBuilder.RequestBuilder.PathParameters)
}