example_test.go 1.6 KB
package example

import (
	"github.com/linmadan/egglib-go/utils/json"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-manufacture/pkg/infrastructure/allied-lib/gateway/allied_creation_user"
	"testing"
)

var host = "http://127.0.0.1:8081"

func TestAlliedUserGatewayLib(t *testing.T) {
	creation := allied_creation_user.NewHttpLibAlliedCreationUser(host)
	user, _ := creation.UserGet(allied_creation_user.ReqGetUser{
		UserId: 2,
	})
	t.Log(json.MarshalToString(user))
	_, users, _ := creation.UserSearch(allied_creation_user.ReqUserSearch{
		Offset: 60,
	})
	t.Log(json.MarshalToString(users))

	company, _ := creation.CompanyGet(allied_creation_user.ReqCompanyGet{
		CompanyId: 2,
	})
	t.Log(json.MarshalToString(company))

	_, companies, _ := creation.CompanySearch(allied_creation_user.ReqCompanySearch{})
	t.Log(json.MarshalToString(companies))

	org, _ := creation.OrgGet(allied_creation_user.ReqOrgGet{
		OrgId: 2,
	})
	t.Log(json.MarshalToString(org))
	_, orgs, _ := creation.OrgSearch(allied_creation_user.ReqOrgSearch{})
	t.Log(json.MarshalToString(orgs))
}

func TestAlliedUserGatewayLibQuick(t *testing.T) {
	creation := allied_creation_user.NewHttpLibAlliedCreationUser(host)
	user, _ := creation.User(2)
	t.Log(json.MarshalToString(user))
	users, _ := creation.Users([]int{2})
	t.Log(json.MarshalToString(users))

	company, _ := creation.Company(2)
	t.Log(json.MarshalToString(company))

	companies, _ := creation.Companies([]int{2})
	t.Log(json.MarshalToString(companies))

	org, _ := creation.Organization(2)
	t.Log(json.MarshalToString(org))
	orgs, _ := creation.Organizations([]int{2})
	t.Log(json.MarshalToString(orgs))
}