123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- // Copyright 2019 getensh.com. All rights reserved.
- // Use of this source code is governed by getensh.com.
- package tests
- import (
- "context"
- v1 "property-task/pb/v1"
- "testing"
- jsoniter "github.com/json-iterator/go"
- )
- var json = jsoniter.ConfigCompatibleWithStandardLibrary
- func Test_CreateUser(t *testing.T) {
- req := &v1.CreateUserRequest{
- Username: "admin",
- Password: "admin",
- }
- r, err := client.CreateUser(context.Background(), req)
- if err == nil {
- s, _ := json.MarshalToString(r)
- t.Log(s)
- } else {
- t.Error("failed to call: ", err)
- }
- }
- func Test_Login(t *testing.T) {
- req := &v1.LoginRequest{
- Username: "admin",
- Password: "admin",
- }
- r, err := client.Login(context.Background(), req)
- if err == nil {
- s, _ := json.MarshalToString(r)
- t.Log(s)
- } else {
- t.Error("failed to call: ", err)
- }
- }
- func Test_ChangePassword(t *testing.T) {
- req := &v1.ChangePasswordRequest{
- Uid: 2,
- Password: "123456",
- }
- r, err := client.ChangePassword(context.Background(), req)
- if err == nil {
- s, _ := json.MarshalToString(r)
- t.Log(s)
- } else {
- t.Error("failed to call: ", err)
- }
- }
- func Test_CreateOrganization(t *testing.T) {
- req := &v1.CreateOrganizationRequest{
- OrganizationName: "成都市",
- Month: 60,
- State: 1,
- }
- r, err := client.CreateOrganization(context.Background(), req)
- if err == nil {
- s, _ := json.MarshalToString(r)
- t.Log(s)
- } else {
- t.Error("failed to call: ", err)
- }
- }
|