Exemplo n.º 1
0
func checkQuery(t *testing.T, stub *shim.MockStub, name string, value string) {
	bytes, err := stub.MockQuery("query", []string{name})
	if err != nil {
		fmt.Println("Query", name, "failed", err)
		t.FailNow()
	}
	if bytes == nil {
		fmt.Println("Query", name, "failed to get value")
		t.FailNow()
	}
	if string(bytes) != value {
		fmt.Println("Query value", name, "was not", value, "as expected")
		t.FailNow()
	}
}
Exemplo n.º 2
0
func checkQuery(t *testing.T, stub *shim.MockStub, args []string, expect string) {
	bytes, err := stub.MockQuery("query", args)
	if err != nil {
		fmt.Println("Query", args, "failed", err)
		t.FailNow()
	}
	if bytes == nil {
		fmt.Println("Query", args, "failed to get result")
		t.FailNow()
	}
	if string(bytes) != expect {
		fmt.Println("Query result ", string(bytes), "was not", expect, "as expected")
		t.FailNow()
	}
}