get_role_access_menus_test.go 1.3 KB
package role

import (
	"github.com/go-pg/pg/v10"
	"net/http"

	"github.com/gavv/httpexpect"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-user/pkg/infrastructure/pg"
)

var _ = Describe("获取角色菜单", func() {
	return
	var roleId int64
	BeforeEach(func() {
		_, err := pG.DB.QueryOne(
			pg.Scan(&roleId),
			"INSERT INTO roles (role_id, company_id, org_id, role_type, role_name, access_menus, desc, ext, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING role_id",
			"testRoleId", "testCompanyId", "testOrgId", "testRoleType", "testRoleName", "testAccessMenus", "testDesc", "testExt", "testCreatedAt", "testUpdatedAt")
		Expect(err).NotTo(HaveOccurred())
	})
	Describe("获取角色菜单", func() {
		Context("", func() {
			It("", func() {
				httpExpect := httpexpect.New(GinkgoT(), server.URL)
				httpExpect.GET("/role/{roleId}/access-menus").
					Expect().
					Status(http.StatusOK).
					JSON().
					Object().
					ContainsKey("code").ValueEqual("code", 0).
					ContainsKey("msg").ValueEqual("msg", "ok").
					ContainsKey("data").Value("data").Object()
			})
		})
	})
	AfterEach(func() {
		_, err := pG.DB.Exec("DELETE FROM roles WHERE true")
		Expect(err).NotTo(HaveOccurred())
	})
})