Skip to content

Commit

Permalink
Remove unneeded imports from chaincode tests
Browse files Browse the repository at this point in the history
Change-Id: I870509063e2ec0277961f72414afc44d85d82447
Signed-off-by: Gabor Hosszu <gabor@digitalasset.com>
  • Loading branch information
gaborh-da committed Aug 23, 2016
1 parent 78c4b68 commit 1ffde44
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"testing"

"github.com/hyperledger/fabric/core/chaincode/shim"
main "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
)

func checkInit(t *testing.T, stub *shim.MockStub, args []string) {
Expand Down Expand Up @@ -68,7 +67,7 @@ func checkInvoke(t *testing.T, stub *shim.MockStub, args []string) {
}

func TestExample02_Init(t *testing.T) {
scc := new(main.SimpleChaincode)
scc := new(SimpleChaincode)
stub := shim.NewMockStub("ex02", scc)

// Init A=123 B=234
Expand All @@ -79,7 +78,7 @@ func TestExample02_Init(t *testing.T) {
}

func TestExample02_Query(t *testing.T) {
scc := new(main.SimpleChaincode)
scc := new(SimpleChaincode)
stub := shim.NewMockStub("ex02", scc)

// Init A=345 B=456
Expand All @@ -93,7 +92,7 @@ func TestExample02_Query(t *testing.T) {
}

func TestExample02_Invoke(t *testing.T) {
scc := new(main.SimpleChaincode)
scc := new(SimpleChaincode)
stub := shim.NewMockStub("ex02", scc)

// Init A=567 B=678
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ import (
"testing"

"github.com/hyperledger/fabric/core/chaincode/shim"
main "github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example03"
)

func checkInit(t *testing.T, scc *main.SimpleChaincode, stub *shim.MockStub, args []string) {
func checkInit(t *testing.T, scc *SimpleChaincode, stub *shim.MockStub, args []string) {
_, err := stub.MockInit("1", "init", args)
if err != nil {
fmt.Println("Init failed", err)
Expand All @@ -43,7 +42,7 @@ func checkState(t *testing.T, stub *shim.MockStub, name string, value string) {
}
}

func checkQuery(t *testing.T, scc *main.SimpleChaincode, stub *shim.MockStub, args []string, value string) {
func checkQuery(t *testing.T, scc *SimpleChaincode, stub *shim.MockStub, args []string, value string) {
bytes, err := scc.Query(stub, "query", args)
if err != nil {
// expected failure
Expand All @@ -62,7 +61,7 @@ func checkQuery(t *testing.T, scc *main.SimpleChaincode, stub *shim.MockStub, ar
}
}

func checkInvoke(t *testing.T, scc *main.SimpleChaincode, stub *shim.MockStub, args []string) {
func checkInvoke(t *testing.T, scc *SimpleChaincode, stub *shim.MockStub, args []string) {
_, err := stub.MockInvoke("1", "query", args)
if err != nil {
fmt.Println("Invoke", args, "failed", err)
Expand All @@ -71,7 +70,7 @@ func checkInvoke(t *testing.T, scc *main.SimpleChaincode, stub *shim.MockStub, a
}

func TestExample03_Init(t *testing.T) {
scc := new(main.SimpleChaincode)
scc := new(SimpleChaincode)
stub := shim.NewMockStub("ex03", scc)

// Init A=123 B=234
Expand All @@ -81,7 +80,7 @@ func TestExample03_Init(t *testing.T) {
}

func TestExample03_Query(t *testing.T) {
scc := new(main.SimpleChaincode)
scc := new(SimpleChaincode)
stub := shim.NewMockStub("ex03", scc)

// Init A=345 B=456
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type SimpleChaincode struct {
func (t *SimpleChaincode) GetChaincodeToCall() string {
//This is the hashcode for github.com/hyperledger/fabric/core/example/chaincode/chaincode_example02
//if the example is modifed this hashcode will change!!
chainCodeToCall := "0588c9b192603a2d39f2223ec524e30119698a36e77369c9d6df2ca16b85043406c67502787362e99f46d68b81b3f59000a149041ddba90047cf72e56fdfce96"
chainCodeToCall := "980d4bb7f69578592e5775a6da86d81a221887817d7164d3e9d4d4df1c981440abf9a61417eaf8ad6f7fc79893da36de2cf4709131e9af39bca6ebc2e5a1cd9d"
return chainCodeToCall
}

Expand Down

0 comments on commit 1ffde44

Please sign in to comment.