batch_enable_menu_test.go
1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package menu
import (
"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() {
var menuId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&menuId),
"INSERT INTO menus (menu_id, parent_id, menu_name, code, access_code, menu_type, icon, sort, remark, category, parent_path, enable_status, is_publish) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING menu_id",
"testMenuId", "testParentId", "testMenuName", "testCode", "testAccessCode", "testMenuType", "testIcon", "testSort", "testRemark", "testCategory", "testParentPath", "testEnableStatus", "testIsPublish")
Expect(err).NotTo(HaveOccurred())
})
Describe("批量启用菜单", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"menuIds": "array",
"status": "int",
}
httpExpect.POST("/menu/batch-enable").
WithJSON(body).
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 menus WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})