예제 #1
0
파일: branch_test.go 프로젝트: kego/ke
func setupForFailedFileLoad(cb *ctests.ClientContextBuilder) {

	// We have to unmarshal the received object, so we'll have to load some types.
	cb.Base.Path("")

	done := make(chan error, 1)
	done <- errors.New("error")

	cb.GetConnection().EXPECT().Go(shared.Data, gomock.Any(), gomock.Any(), gomock.Any()).Return(done)

}
예제 #2
0
파일: branch_test.go 프로젝트: kego/ke
func setupForSuccessfulFileLoad(t *testing.T, cb *ctests.ClientContextBuilder) {

	// We have to unmarshal the received object, so we'll have to load some types.
	cb.Base.Path("").Jauto().Sauto(parser.Parse)

	done := make(chan error, 1)

	do := func(method shared.Method, args interface{}, reply interface{}, fail chan error) chan error {
		// Create a simple ke object and marshal it to a []byte
		var bytes []byte
		bytes, err := system.Marshal(cb.Ctx(), &system.Object{Type: system.NewReference("system", "object")})
		require.NoError(t, err)
		reply.(*shared.DataResponse).Found = true
		reply.(*shared.DataResponse).Data = bytes
		close(done)
		return done
	}

	cb.GetConnection().EXPECT().Go(shared.Data, gomock.Any(), gomock.Any(), gomock.Any()).Do(do).Return(done)
}