set_online_test.go
1.7 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
46
47
48
package product_plan
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-manufacture/pkg/infrastructure/pg"
)
var _ = Describe("计划上线", func() {
var productPlanId int64
BeforeEach(func() {
_, err := pG.DB.QueryOne(
pg.Scan(&productPlanId),
"INSERT INTO product_plans (product_plan_id, company_id, org_id, batch_number, product_date, workshop, work_on, machine, plan_product_name, plan_devoted, plan_status, work_station, remark, created_at, updated_at, deleted_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING product_plan_id",
"testProductPlanId", "testCompanyId", "testOrgId", "testBatchNumber", "testProductDate", "testWorkshop", "testWorkOn", "testMachine", "testPlanProductName", "testPlanDevoted", "testPlanStatus", "testWorkStation", "testRemark", "testCreatedAt", "testUpdatedAt", "testDeletedAt")
Expect(err).NotTo(HaveOccurred())
})
Describe("计划上线", func() {
Context("", func() {
It("", func() {
httpExpect := httpexpect.New(GinkgoT(), server.URL)
body := map[string]interface{}{
"productPlanId": "int",
"workshopId": "int",
"lineId": "int",
"sectionId": "int",
}
httpExpect.POST("/product-plans/set-online").
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 product_plans WHERE true")
Expect(err).NotTo(HaveOccurred())
})
})