github.com/vipernet-xyz/tm@v0.34.24/cmd/contract_tests/main.go (about)

     1  package main
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	"github.com/snikch/goodman/hooks"
     8  	"github.com/snikch/goodman/transaction"
     9  )
    10  
    11  func main() {
    12  	// This must be compiled beforehand and given to dredd as parameter, in the meantime the server should be running
    13  	h := hooks.NewHooks()
    14  	server := hooks.NewServer(hooks.NewHooksRunner(h))
    15  	h.BeforeAll(func(t []*transaction.Transaction) {
    16  		fmt.Println(t[0].Name)
    17  	})
    18  	h.BeforeEach(func(t *transaction.Transaction) {
    19  		if strings.HasPrefix(t.Name, "Tx") ||
    20  			// We need a proper example of evidence to broadcast
    21  			strings.HasPrefix(t.Name, "Info > /broadcast_evidence") ||
    22  			// We need a proper example of path and data
    23  			strings.HasPrefix(t.Name, "ABCI > /abci_query") ||
    24  			// We need to find a way to make a transaction before starting the tests,
    25  			// that hash should replace the dummy one in the openapi file
    26  			strings.HasPrefix(t.Name, "Info > /tx") {
    27  			t.Skip = true
    28  			fmt.Printf("%s Has been skipped\n", t.Name)
    29  		}
    30  	})
    31  	server.Serve()
    32  	defer server.Listener.Close()
    33  	fmt.Print("FINE")
    34  }