| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package im
- import (
- "git.beswell.com/gframe/application"
- "github.com/sirupsen/logrus"
- "google.golang.org/grpc"
- "sportfitness/base/global"
- pb "sportfitness/base/repository/grpc/bsw/im/im"
- "testing"
- )
- func init() {
- logrus.Info("test init")
- app := application.NewDefault()
- err := app.AddServiceGrpcClient("bsw/im")
- if err != nil {
- panic(err)
- }
- global.SysToken = "3374a2b5a483ed1263f3574666e1ab5e"
- }
- func TestSignUp(t *testing.T) {
- id := SignUpUserCode(&pb.SignUpRequest{
- UserCode: "test123",
- Name: "测试123",
- Email: "",
- Phone: "",
- WxOpenId: "",
- Qq: "",
- Password: "123456",
- Question: "",
- Answer: "",
- Memo: "",
- })
- println(id)
- _, err := getClient().SystemAddUser(ctx(), &pb.SystemAddUserRequest{
- UserId: id,
- Memo: "测试",
- })
- if err != nil {
- panic(err)
- }
- }
- func TestMD(t *testing.T) {
- conn, err := grpc.Dial("localhost:19090", grpc.WithInsecure())
- if err != nil {
- panic(err)
- }
- client := pb.NewApiClient(conn)
- _, err = client.SignInUserCode(ctx(), &pb.SignInPasswordRequest{
- Credential: "",
- Password: "",
- SysId: 0,
- ExpirationSec: 0,
- Ip: "123123",
- ClientInfo: "",
- })
- _, err = client.SystemAddUser(ctx(), &pb.SystemAddUserRequest{
- UserId: 167676470552965120,
- Memo: "测试",
- })
- if err != nil {
- panic(err)
- }
- }
- func TestSignInUserCodePassword(t *testing.T) {
- token, userId := SignInUserCodePassword(
- "test123", "123456", "192.168.0.100", "web")
- println(token, userId)
- }
|