// Copyright 2019 getensh.com. All rights reserved. // Use of this source code is governed by getensh.com. package tests import ( "context" v1 "property-device/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) } }