test
This commit is contained in:
parent
21a69eda33
commit
007f2c462b
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
"gitea.cdlsxd.cn/sdk/plugin/proto"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -70,7 +71,19 @@ func TestQuery(t *testing.T) {
|
||||||
t.Errorf("Query() error = %v", err)
|
t.Errorf("Query() error = %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
result := got.String()
|
||||||
fmt.Printf("%+v \n", got)
|
fmt.Printf("%+v \n", got)
|
||||||
|
fmt.Printf("%s \n", got.Result.String())
|
||||||
|
|
||||||
|
index := strings.Index(result, "result:")
|
||||||
|
if index == -1 {
|
||||||
|
fmt.Println("result: not found in the string")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 截取 result: 后面的部分
|
||||||
|
trimmedResult := result[index+len("result:"):]
|
||||||
|
fmt.Println(trimmedResult)
|
||||||
|
|
||||||
assert.Equal(t, int(proto.Status_SUCCESS), int(got.Result.Status))
|
assert.Equal(t, int(proto.Status_SUCCESS), int(got.Result.Status))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue