github.com/lino-network/lino@v0.6.11/test/post/publish_test.go (about)

     1  package post
     2  
     3  import (
     4  	"testing"
     5  	"time"
     6  
     7  	"github.com/lino-network/lino/test"
     8  	// "github.com/lino-network/lino/types"
     9  	// post "github.com/lino-network/lino/x/post"
    10  	"github.com/tendermint/tendermint/crypto/secp256k1"
    11  )
    12  
    13  // test publish a normal post
    14  func TestNormalPublish(t *testing.T) {
    15  	newAccountTransactionPriv := secp256k1.GenPrivKey()
    16  	newAccountName := "newuser"
    17  	postID1 := "New Post 1"
    18  	postID2 := "New Post 2"
    19  	// recover some coin day
    20  	baseT := time.Unix(0, 0).Add(3600 * time.Second)
    21  	baseTime := baseT.Unix()
    22  	lb := test.NewTestLinoBlockchain(t, test.DefaultNumOfVal, baseT)
    23  
    24  	test.CreateAccount(t, newAccountName, lb, 0,
    25  		secp256k1.GenPrivKey(), newAccountTransactionPriv, "100")
    26  
    27  	test.CreateTestPost(
    28  		t, lb, newAccountName, postID1, 1, newAccountTransactionPriv, baseTime)
    29  	test.SimulateOneBlock(lb, baseTime+test.PostIntervalSec)
    30  	test.CreateTestPost(
    31  		t, lb, newAccountName, postID2, 2, newAccountTransactionPriv, baseTime+test.PostIntervalSec)
    32  }