-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add finance integ test passed * all finance/product/reverseorder integration tests passed Co-authored-by: yan.jinbin <yan.jinbin@shipper.id>
- Loading branch information
Showing
38 changed files
with
2,028 additions
and
1,051 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
//go:build integration | ||
|
||
package tiktok_test | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"os" | ||
"testing" | ||
|
||
"github.com/ipfans/tiktok" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestClient_SearchSettlements_Integration(t *testing.T) { | ||
c := newTestClient(t) | ||
type args struct { | ||
ak string | ||
shopID string | ||
query tiktok.SearchSettlementsRequest | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
wantList string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: " SearchSettlements Integration Test ", | ||
args: args{ | ||
ak: os.Getenv(_AK_KEY), | ||
shopID: os.Getenv(_SHOP_KEY), | ||
query: tiktok.SearchSettlementsRequest{ | ||
PageSize: _PAGESIZE, | ||
SortType: _SORT_TYPE, | ||
RequestTimeTo: 1691224452, | ||
RequestTimeFrom: 1558152466, | ||
}, | ||
}, | ||
wantErr: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
ans, err := c.SearchSettlements(context.TODO(), tiktok.Param{AccessToken: tt.args.ak, ShopID: tt.args.shopID}, tt.args.query) | ||
require.Equal(t, tt.wantErr, err != nil, "Client.SearchSettlements() error = %v, wantErr %v", err, tt.wantErr) | ||
if err != nil { | ||
return | ||
} | ||
if len(ans.SettlementList) == 0 { | ||
return | ||
} | ||
b, _ := json.Marshal(ans) | ||
jsonData := string(b) | ||
t.Log(jsonData) | ||
}) | ||
} | ||
} | ||
|
||
func TestClient_GetOrderSettlements_Integration(t *testing.T) { | ||
c := newTestClient(t) | ||
type args struct { | ||
ak string | ||
shopID string | ||
query string | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
wantList string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: " GetOrderSettlements Integration Test ", | ||
args: args{ | ||
ak: os.Getenv(_AK_KEY), | ||
shopID: os.Getenv(_SHOP_KEY), | ||
query: _ORDERIDStr, | ||
}, | ||
wantErr: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
ans, err := c.GetOrderSettlements(context.TODO(), tiktok.Param{AccessToken: tt.args.ak, ShopID: tt.args.shopID}, tt.args.query) | ||
require.Equal(t, tt.wantErr, err != nil, "Client.GetOrderSettlements() error = %v, wantErr %v", err, tt.wantErr) | ||
if err != nil { | ||
return | ||
} | ||
require.NotEmpty(t, ans.SettlementList) | ||
b, _ := json.Marshal(ans) | ||
jsonData := string(b) | ||
t.Log(jsonData) | ||
}) | ||
} | ||
} | ||
|
||
func TestClient_SearchTransactions_Integration(t *testing.T) { | ||
c := newTestClient(t) | ||
type args struct { | ||
ak string | ||
shopID string | ||
query tiktok.SearchTransactionsRequest | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
wantList string | ||
wantErr bool | ||
}{ | ||
{ | ||
name: " SearchTransactions Integration Test ", | ||
args: args{ | ||
ak: os.Getenv(_AK_KEY), | ||
shopID: os.Getenv(_SHOP_KEY), | ||
query: tiktok.SearchTransactionsRequest{ | ||
PageSize: _PAGESIZE, | ||
// Withdraw:1 Settle:2 Transfer:3 Reverse:4 | ||
TransactionType: []int{1, 2, 3, 4}, | ||
}, | ||
}, | ||
wantErr: true, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
_, err := c.SearchTransactions(context.TODO(), tiktok.Param{AccessToken: tt.args.ak, ShopID: tt.args.shopID}, tt.args.query) | ||
require.Equal(t, tt.wantErr, err != nil, "Client.SearchTransactions() error = %v, wantErr %v", err, tt.wantErr) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.