-
Notifications
You must be signed in to change notification settings - Fork 73
/
user_test.go
53 lines (45 loc) · 1.4 KB
/
user_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
package kiteconnect
import (
"testing"
)
func (ts *TestSuite) TestGetUserProfile(t *testing.T) {
t.Parallel()
profile, err := ts.KiteConnect.GetUserProfile()
if err != nil || profile.Email == "" || profile.UserID == "" {
t.Errorf("Error while reading user profile. Error: %v", err)
}
}
func (ts *TestSuite) TestGetFullUserProfile(t *testing.T) {
t.Parallel()
fullProfile, err := ts.KiteConnect.GetFullUserProfile()
if err != nil || fullProfile.Email == "" || fullProfile.UserID == "" {
t.Errorf("Error while reading full user profile. Error: %v", err)
}
}
func (ts *TestSuite) TestGetUserMargins(t *testing.T) {
t.Parallel()
margins, err := ts.KiteConnect.GetUserMargins()
if err != nil {
t.Errorf("Error while reading user margins. Error: %v", err)
}
if !margins.Equity.Enabled || !margins.Commodity.Enabled {
t.Errorf("Incorrect margin values.")
}
}
func (ts *TestSuite) TestGetUserSegmentMargins(t *testing.T) {
t.Parallel()
margins, err := ts.KiteConnect.GetUserSegmentMargins("test")
if err != nil {
t.Errorf("Error while reading user margins. Error: %v", err)
}
if !margins.Enabled {
t.Errorf("Incorrect segment margin values.")
}
}
func (ts *TestSuite) TestInvalidateAccessToken(t *testing.T) {
t.Parallel()
sessionLogout, err := ts.KiteConnect.InvalidateAccessToken()
if err != nil || !sessionLogout == true {
t.Errorf("Error while invalidating user session. Error: %v", err)
}
}