계정 제재 동작 오류 수정
This commit is contained in:
39
core/api_test.go
Normal file
39
core/api_test.go
Normal file
@ -0,0 +1,39 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"repositories.action2quare.com/ayo/gocommon"
|
||||
)
|
||||
|
||||
func TestMakeLocalUniqueId(t *testing.T) {
|
||||
ts := int64(1690815600)
|
||||
start := primitive.NewDateTimeFromTime(time.Unix(ts, 0))
|
||||
ts = int64(1693493999)
|
||||
end := primitive.NewDateTimeFromTime(time.Unix(ts, 0))
|
||||
|
||||
fmt.Println(start.Time().Format(time.RFC3339))
|
||||
fmt.Println(end.Time().Format(time.RFC3339))
|
||||
|
||||
mongoClient, err := gocommon.NewMongoClient(context.Background(), "mongodb://121.134.91.160:27018/?replicaSet=rs0&retrywrites=true", "mountain-maingate")
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
bi := blockinfo{
|
||||
Start: start,
|
||||
End: end,
|
||||
Reason: "test",
|
||||
}
|
||||
mongoClient.Update(CollectionBlock, bson.M{
|
||||
"_id": primitive.NewObjectID(),
|
||||
}, bson.M{
|
||||
"$set": &bi,
|
||||
}, options.Update().SetUpsert(true))
|
||||
}
|
||||
Reference in New Issue
Block a user