rpc_test.go 683 B

12345678910111213141516171819202122232425262728
  1. // rpc_test
  2. package rpc
  3. import (
  4. "log"
  5. "testing"
  6. )
  7. func Test_InCreadit(t *testing.T) {
  8. rc := new(RpcCall)
  9. rc.Addr = "127.0.0.1:8765"
  10. otherParam := make(map[string]interface{})
  11. otherParam["name"] = "zhangsan"
  12. otherParam["age"] = 18
  13. err := rc.InCreadit(&CreditData{Code: "1", Uid: "2", Num: 3, OtherParam: otherParam}, 0)
  14. log.Println("err:", err)
  15. }
  16. func Test_OutCreadit(t *testing.T) {
  17. rc := new(RpcCall)
  18. rc.Addr = "127.0.0.1:8765"
  19. otherParam := make(map[string]interface{})
  20. otherParam["name"] = "zhangsan"
  21. otherParam["age"] = 18
  22. replay := 0
  23. err := rc.OutCreadit(&CreditData{Code: "1", Uid: "2", Num: 3, OtherParam: otherParam}, &replay)
  24. log.Println("err:", err)
  25. }