139 lines
2.6 KiB
Go
139 lines
2.6 KiB
Go
|
|
package onexbet
|
||
|
|
|
||
|
|
import (
|
||
|
|
"encoding/json"
|
||
|
|
"fmt"
|
||
|
|
"testing"
|
||
|
|
)
|
||
|
|
|
||
|
|
/*
|
||
|
|
func TestSearchTeamCandidates(t *testing.T) {
|
||
|
|
list, err := SearchTeamMatches(tennisLiveSearchURL, "Gunko")
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
for _, m := range list {
|
||
|
|
fmt.Printf("%#v\n\n", m)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
func TestLoadTeamLiveMatchData(t *testing.T) {
|
||
|
|
data, isMatchFinished, err := LoadTeamLiveMatchData("295524958")
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
buf, _ := json.MarshalIndent(data, "", " ")
|
||
|
|
fmt.Printf("%s\n", buf)
|
||
|
|
fmt.Printf("isMatchFinished: %t\n", isMatchFinished)
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
/*
|
||
|
|
func TestSearchMatchCandidates(t *testing.T) {
|
||
|
|
list, err := SearchMatchCandidates("west ham", "manchester city", nil)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
for _, m := range list {
|
||
|
|
fmt.Printf("%#v\n\n", m)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/*
|
||
|
|
func TestListLiveMatchesBySport(t *testing.T) {
|
||
|
|
list, err := ListLiveMatchesBySport(Tennis)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
for _, m := range list {
|
||
|
|
buf, _ := json.MarshalIndent(m, "", " ")
|
||
|
|
fmt.Printf("%s\n", buf)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
|
||
|
|
/*
|
||
|
|
func TestLoadTeamLiveMatchData(t *testing.T) {
|
||
|
|
list, err := ListLiveMatchesBySport(Handball)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if len(list) == 0 {
|
||
|
|
fmt.Printf("No live matches\n")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
data, err := LoadTeamLiveMatchData(list[0].MatchID)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
buf, _ := json.MarshalIndent(data, "", " ")
|
||
|
|
fmt.Printf("%s\n", buf)
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
/*
|
||
|
|
|
||
|
|
*/
|
||
|
|
|
||
|
|
func TestGetTennisMatchResult(t *testing.T) {
|
||
|
|
onexbetStatsMatchID := "610afdf8f75a663f695c36ac"
|
||
|
|
stat, err := GetTennisMatchResult(onexbetStatsMatchID)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
fmt.Printf("onexbetStatsMatchID: %s\n", onexbetStatsMatchID)
|
||
|
|
buf, _ := json.MarshalIndent(stat, "", " ")
|
||
|
|
fmt.Printf("%s\n", buf)
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
func TestLoadTennisLiveMatchDataOfFirstInLive(t *testing.T) {
|
||
|
|
list, err := ListLiveMatchesBySport(Tennis)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
if len(list) == 0 {
|
||
|
|
fmt.Printf("No live matches\n")
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
data, isMatchFinished, err := LoadTennisLiveMatchData(list[0].MatchID)
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
buf, _ := json.MarshalIndent(data, "", " ")
|
||
|
|
fmt.Printf("%s\nisMatchFinished: %t\n", buf, isMatchFinished)
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestLoadTennisLiveMatchData(t *testing.T) {
|
||
|
|
data, isMatchFinished, err := LoadTennisLiveMatchData("298023063")
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
buf, _ := json.MarshalIndent(data, "", " ")
|
||
|
|
fmt.Printf("%s\nisMatchFinished: %t\n", buf, isMatchFinished)
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
/*
|
||
|
|
func TestGetTeamMatchResult(t *testing.T) {
|
||
|
|
stat, err := GetTeamMatchResult("60257269f75a663f693fd68d")
|
||
|
|
if err != nil {
|
||
|
|
t.Fatal(err)
|
||
|
|
}
|
||
|
|
|
||
|
|
buf, _ := json.MarshalIndent(stat, "", " ")
|
||
|
|
fmt.Printf("%s\n", buf)
|
||
|
|
}
|
||
|
|
*/
|