forked from ionos-enterprise/ionos-enterprise-sdk-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client_test.go
34 lines (26 loc) · 673 Bytes
/
client_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
package profitbricks
import (
"os"
"testing"
"github.com/jarcoal/httpmock"
"github.com/stretchr/testify/suite"
"github.com/stretchr/testify/assert"
)
func TestNewClientParams(t *testing.T) {
pbc := NewClient(os.Getenv("PROFITBRICKS_API_URL"), os.Getenv("PROFITBRICKS_USERNAME"))
pbc.SetDepth(5)
pbc.SetUserAgent("blah")
assert.Equal(t, "blah", pbc.GetUserAgent())
assert.Equal(t, "5", pbc.QueryParam.Get("depth"))
}
type ClientBaseSuite struct {
suite.Suite
c *Client
}
func (s *ClientBaseSuite) SetupTest() {
s.c = NewClient("", "")
httpmock.ActivateNonDefault(s.c.Client.GetClient())
}
func (s *ClientBaseSuite) TearDownTest() {
httpmock.Reset()
}