2020-07-07 10:39:24 +00:00
|
|
|
package intimate
|
2020-07-07 04:04:05 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2020-07-08 10:57:57 +00:00
|
|
|
|
|
|
|
"github.com/tidwall/gjson"
|
2020-07-07 04:04:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestStoreInsert(t *testing.T) {
|
2020-07-07 10:14:14 +00:00
|
|
|
// ht := hunter.NewHunter(openrecRanking)
|
|
|
|
// ht.Execute()
|
2020-07-07 08:17:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestStoreInsertCase1(t *testing.T) {
|
|
|
|
// extractorURI := "root:@tcp(127.0.0.1:4000)/intimate_extractor?charset=utf8"
|
|
|
|
// db, err := sql.Open("mysql", extractorURI)
|
|
|
|
// defer db.Close()
|
|
|
|
// if err != nil {
|
|
|
|
// t.Error(err)
|
|
|
|
// }
|
|
|
|
|
|
|
|
// insertsql := "insert into anchor_info(uid, platform, anchor_name, platform_url) values(?,?,?,?)"
|
|
|
|
// _, err = db.Exec(insertsql, string(uuid.NewV4().String()), "1", "1", "1")
|
|
|
|
// t.Error(err, len(uuid.NewV4().String()))
|
|
|
|
|
2020-07-07 04:04:05 +00:00
|
|
|
}
|
2020-07-08 07:02:55 +00:00
|
|
|
|
|
|
|
func TestStorePopCase1(t *testing.T) {
|
|
|
|
store := NewStore("source_openrec")
|
2020-07-08 10:57:57 +00:00
|
|
|
source, err := store.Pop("openrec_ranking")
|
|
|
|
if err != nil {
|
|
|
|
t.Error(err)
|
|
|
|
}
|
|
|
|
t.Error(source.GetOperator())
|
|
|
|
t.Error(gjson.Valid(source.GetSource().String))
|
|
|
|
result := gjson.Parse(source.GetSource().String)
|
|
|
|
if result.IsArray() {
|
|
|
|
for _, User := range result.Array() {
|
|
|
|
t.Error(User.Get("channel.id").String())
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
t.Error("array error")
|
|
|
|
}
|
|
|
|
|
2020-07-08 07:02:55 +00:00
|
|
|
}
|