-
Notifications
You must be signed in to change notification settings - Fork 3
/
mixpanel_test.go
49 lines (40 loc) · 1.36 KB
/
mixpanel_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
package mixpanel
import (
"os"
"testing"
"github.com/stretchr/testify/require"
)
func TestMixpanelOptions(t *testing.T) {
t.Run("eu residency", func(t *testing.T) {
mp := NewApiClient("", EuResidency())
require.Equal(t, mp.apiEndpoint, euEndpoint)
require.Equal(t, mp.dataEndpoint, euDataEndpoint)
})
t.Run("api secret", func(t *testing.T) {
mp := NewApiClient("", ApiSecret("api-secret"))
require.Equal(t, "api-secret", mp.apiSecret)
})
t.Run("service account", func(t *testing.T) {
mp := NewApiClient("", ServiceAccount(117, "username", "secret"))
require.NotNil(t, mp.serviceAccount)
require.Equal(t, 117, mp.projectID)
require.Equal(t, "username", mp.serviceAccount.Username)
require.Equal(t, "secret", mp.serviceAccount.Secret)
})
t.Run("set api proxy", func(t *testing.T) {
mp := NewApiClient("", ProxyApiLocation("https://localhost:8080"))
require.Equal(t, "https://localhost:8080", mp.apiEndpoint)
})
t.Run("set data proxy", func(t *testing.T) {
mp := NewApiClient("", ProxyDataLocation("https://localhost:8080"))
require.Equal(t, "https://localhost:8080", mp.dataEndpoint)
})
t.Run("debug http", func(t *testing.T) {
mp := NewApiClient("", DebugHttpCalls(os.Stdout))
require.NotNil(t, mp.debugHttpCall)
})
t.Run("http client", func(t *testing.T) {
mp := NewApiClient("", HttpClient(nil))
require.Nil(t, mp.client)
})
}