Skip to content

Commit

Permalink
test(integration): get api key
Browse files Browse the repository at this point in the history
  • Loading branch information
hirokisan committed Feb 19, 2023
1 parent 9657351 commit f1cc649
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 12 deletions.
48 changes: 48 additions & 0 deletions integrationtest/v5/user/testdata/v5-user-get-api-key.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"id": "214087",
"note": "full3",
"apiKey": "TrswBXTLDVhxqkfDEI",
"readOnly": 0,
"secret": "",
"permissions": {
"ContractTrade": [
"Order",
"Position"
],
"Spot": [
"SpotTrade"
],
"Wallet": [
"AccountTransfer",
"SubMemberTransfer"
],
"Options": [
"OptionsTrade"
],
"Derivatives": [
"DerivativesTrade"
],
"CopyTrading": [
"CopyTrading"
],
"BlockTrade": [],
"Exchange": [
"ExchangeHistory"
],
"NFT": []
},
"ips": [
"*"
],
"type": 1,
"deadlineDay": 63,
"expiredAt": "2023-04-23T05:52:24Z",
"createdAt": "2022-06-20T13:26:50Z",
"unified": 0,
"uta": 1,
"userID": 146940,
"inviterID": 0,
"vipLevel": "No VIP",
"mktMakerLevel": "0",
"affiliateID": 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import (
"github.com/stretchr/testify/require"
)

func TestGetPositionInfo(t *testing.T) {
func TestGetAPIKey(t *testing.T) {
client := bybit.NewTestClient().WithAuthFromEnv()
res, err := client.V5().User().GetAPIKeyInfo()
res, err := client.V5().User().GetAPIKey()
require.NoError(t, err)
{
goldenFilename := "./testdata/v5-user-get-api-key-info.json" // TODO
goldenFilename := "./testdata/v5-user-get-api-key.json"
testhelper.Compare(t, goldenFilename, testhelper.ConvertToJSON(res.Result))
testhelper.UpdateFile(t, goldenFilename, testhelper.ConvertToJSON(res.Result))
}
Expand Down
18 changes: 9 additions & 9 deletions v5_user_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ type V5ApiKeyResult struct {
ReadOnly int `json:"readOnly"`
Secret string `json:"secret"`
Permissions struct {
ContractTrade []interface{} `json:"ContractTrade"`
Spot []interface{} `json:"Spot"`
Wallet []string `json:"Wallet"`
Options []interface{} `json:"Options"`
Derivatives []interface{} `json:"Derivatives"`
CopyTrading []interface{} `json:"CopyTrading"`
BlockTrade []interface{} `json:"BlockTrade"`
Exchange []interface{} `json:"Exchange"`
Nft []interface{} `json:"NFT"`
ContractTrade []string `json:"ContractTrade"`
Spot []string `json:"Spot"`
Wallet []string `json:"Wallet"`
Options []string `json:"Options"`
Derivatives []string `json:"Derivatives"`
CopyTrading []string `json:"CopyTrading"`
BlockTrade []string `json:"BlockTrade"`
Exchange []string `json:"Exchange"`
Nft []string `json:"NFT"`
} `json:"permissions"`
Ips []string `json:"ips"`
Type int `json:"type"`
Expand Down

0 comments on commit f1cc649

Please sign in to comment.