正在显示
17 个修改的文件
包含
758 行增加
和
0 行删除
1 | +package dictionary | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("创建数据字典设置", func() { | ||
13 | + Describe("提交数据创建数据字典设置", func() { | ||
14 | + Context("提交正确的新字典数据", func() { | ||
15 | + It("返回字典数据", func() { | ||
16 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
17 | + body := map[string]interface{}{ | ||
18 | + "dictionaryId": "int", | ||
19 | + "dictCode": "string", | ||
20 | + "dictName": "string", | ||
21 | + "desc": "string", | ||
22 | + "isShow": "int", | ||
23 | + "dictItems": "array", | ||
24 | + } | ||
25 | + httpExpect.POST("/dictionarys/"). | ||
26 | + WithJSON(body). | ||
27 | + Expect(). | ||
28 | + Status(http.StatusOK). | ||
29 | + JSON(). | ||
30 | + Object(). | ||
31 | + ContainsKey("code").ValueEqual("code", 0). | ||
32 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
33 | + ContainsKey("data").Value("data").Object(). | ||
34 | + ContainsKey("dictionaryId").ValueNotEqual("dictionaryId", BeZero()) | ||
35 | + }) | ||
36 | + }) | ||
37 | + }) | ||
38 | + AfterEach(func() { | ||
39 | + _, err := pG.DB.Exec("DELETE FROM dictionarys WHERE true") | ||
40 | + Expect(err).NotTo(HaveOccurred()) | ||
41 | + }) | ||
42 | +}) |
1 | +package dictionary | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + "net/http/httptest" | ||
6 | + "testing" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/server/web" | ||
9 | + . "github.com/onsi/ginkgo" | ||
10 | + . "github.com/onsi/gomega" | ||
11 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
12 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/port/beego" | ||
13 | +) | ||
14 | + | ||
15 | +func TestDictionary(t *testing.T) { | ||
16 | + RegisterFailHandler(Fail) | ||
17 | + RunSpecs(t, "Beego Port Dictionary Correlations Test Case Suite") | ||
18 | +} | ||
19 | + | ||
20 | +var handler http.Handler | ||
21 | +var server *httptest.Server | ||
22 | + | ||
23 | +var _ = BeforeSuite(func() { | ||
24 | + handler = web.BeeApp.Handlers | ||
25 | + server = httptest.NewServer(handler) | ||
26 | +}) | ||
27 | + | ||
28 | +var _ = AfterSuite(func() { | ||
29 | + server.Close() | ||
30 | +}) |
1 | +package dictionary | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("返回数据字典设置", func() { | ||
13 | + var dictionaryId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(&dictionaryId), | ||
17 | + "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, desc, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", | ||
18 | + "testDictionaryId", "testDictCode", "testDictName", "testDesc", "testIsShow", "testDictItems") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("根据dictionaryId参数返回字典", func() { | ||
22 | + Context("传入有效的dictionaryId", func() { | ||
23 | + It("返回字典数据", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + httpExpect.GET("/dictionarys/{dictionaryId}"). | ||
26 | + Expect(). | ||
27 | + Status(http.StatusOK). | ||
28 | + JSON(). | ||
29 | + Object(). | ||
30 | + ContainsKey("code").ValueEqual("code", 0). | ||
31 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
32 | + ContainsKey("data").Value("data").Object() | ||
33 | + }) | ||
34 | + }) | ||
35 | + }) | ||
36 | + AfterEach(func() { | ||
37 | + _, err := pG.DB.Exec("DELETE FROM dictionarys WHERE true") | ||
38 | + Expect(err).NotTo(HaveOccurred()) | ||
39 | + }) | ||
40 | +}) |
1 | +package dictionary | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("返回数据字典设置列表", func() { | ||
13 | + var dictionaryId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(&dictionaryId), | ||
17 | + "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, desc, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", | ||
18 | + "testDictionaryId", "testDictCode", "testDictName", "testDesc", "testIsShow", "testDictItems") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("根据参数返回字典列表", func() { | ||
22 | + Context("传入有效的参数", func() { | ||
23 | + It("返回字典数据列表", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + httpExpect.GET("/dictionarys/"). | ||
26 | + WithQuery("offset", "int"). | ||
27 | + WithQuery("limit", "int"). | ||
28 | + Expect(). | ||
29 | + Status(http.StatusOK). | ||
30 | + JSON(). | ||
31 | + Object(). | ||
32 | + ContainsKey("code").ValueEqual("code", 0). | ||
33 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
34 | + ContainsKey("data").Value("data").Object(). | ||
35 | + ContainsKey("count").ValueEqual("count", 1). | ||
36 | + ContainsKey("dictionarys").Value("dictionarys").Array() | ||
37 | + }) | ||
38 | + }) | ||
39 | + }) | ||
40 | + AfterEach(func() { | ||
41 | + _, err := pG.DB.Exec("DELETE FROM dictionarys WHERE true") | ||
42 | + Expect(err).NotTo(HaveOccurred()) | ||
43 | + }) | ||
44 | +}) |
1 | +package dictionary | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("更新数据字典设置", func() { | ||
13 | + var dictionaryId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(&dictionaryId), | ||
17 | + "INSERT INTO dictionarys (dictionary_id, dict_code, dict_name, desc, is_show, dict_items) VALUES (?, ?, ?, ?, ?, ?) RETURNING dictionary_id", | ||
18 | + "testDictionaryId", "testDictCode", "testDictName", "testDesc", "testIsShow", "testDictItems") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("提交数据更新数据字典设置", func() { | ||
22 | + Context("提交正确的字典数据", func() { | ||
23 | + It("返回更新后的字典数据", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "dictionaryId": "int", | ||
27 | + "dictCode": "string", | ||
28 | + "dictName": "string", | ||
29 | + "desc": "string", | ||
30 | + "isShow": "int", | ||
31 | + "dictItems": "array", | ||
32 | + } | ||
33 | + httpExpect.PUT("/dictionarys/{dictionaryId}"). | ||
34 | + WithJSON(body). | ||
35 | + Expect(). | ||
36 | + Status(http.StatusOK). | ||
37 | + JSON(). | ||
38 | + Object(). | ||
39 | + ContainsKey("code").ValueEqual("code", 0). | ||
40 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
41 | + ContainsKey("data").Value("data").Object(). | ||
42 | + ContainsKey("dictionaryId").ValueEqual("dictionaryId", dictionaryId) | ||
43 | + }) | ||
44 | + }) | ||
45 | + }) | ||
46 | + AfterEach(func() { | ||
47 | + _, err := pG.DB.Exec("DELETE FROM dictionarys WHERE true") | ||
48 | + Expect(err).NotTo(HaveOccurred()) | ||
49 | + }) | ||
50 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("设置消息:共创申请审核通过", func() { | ||
13 | + var noticePersonalId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬icePersonalId), | ||
17 | + "INSERT INTO notice_personals (created_at, deleted_at, updated_at, extend, company_id, content, is_read, module, module_action, notice_personal_id, org_id, sys_code, user_id, user_base_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_personal_id", | ||
18 | + "testCreatedAt", "testDeletedAt", "testUpdatedAt", "testExtend", "testCompanyId", "testContent", "testIsRead", "testModule", "testModuleAction", "testNoticePersonalId", "testOrgId", "testSysCode", "testUserId", "testUserBaseId") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("设置消息:共创申请审核通过", func() { | ||
22 | + Context("", func() { | ||
23 | + It("", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "userId": "int64", | ||
27 | + "userBaseId": "int64", | ||
28 | + "orgId": "int64", | ||
29 | + "companyId": "int64", | ||
30 | + "creationProjectId": "int64", | ||
31 | + "creationProjectName": "string", | ||
32 | + "creationProjectNumber": "string", | ||
33 | + } | ||
34 | + httpExpect.POST("/notice-personal/agree-join-creation-project"). | ||
35 | + WithJSON(body). | ||
36 | + Expect(). | ||
37 | + Status(http.StatusOK). | ||
38 | + JSON(). | ||
39 | + Object(). | ||
40 | + ContainsKey("code").ValueEqual("code", 0). | ||
41 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
42 | + ContainsKey("data").Value("data").Object() | ||
43 | + }) | ||
44 | + }) | ||
45 | + }) | ||
46 | + AfterEach(func() { | ||
47 | + _, err := pG.DB.Exec("DELETE FROM notice_personals WHERE true") | ||
48 | + Expect(err).NotTo(HaveOccurred()) | ||
49 | + }) | ||
50 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("设置消息:共创申请审核通过", func() { | ||
13 | + var noticePersonalId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬icePersonalId), | ||
17 | + "INSERT INTO notice_personals (created_at, deleted_at, updated_at, extend, company_id, content, is_read, module, module_action, notice_personal_id, org_id, sys_code, user_id, user_base_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_personal_id", | ||
18 | + "testCreatedAt", "testDeletedAt", "testUpdatedAt", "testExtend", "testCompanyId", "testContent", "testIsRead", "testModule", "testModuleAction", "testNoticePersonalId", "testOrgId", "testSysCode", "testUserId", "testUserBaseId") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("设置消息:共创申请审核通过", func() { | ||
22 | + Context("", func() { | ||
23 | + It("", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "userId": "int64", | ||
27 | + "userBaseId": "int64", | ||
28 | + "orgId": "int64", | ||
29 | + "companyId": "int64", | ||
30 | + "creditAccountOrderNum": "string", | ||
31 | + "settlementAmount": "string", | ||
32 | + "creditAccountId": "int64", | ||
33 | + "dividendsEstimateId": "int64", | ||
34 | + "dividendsEstimateOrderNumber": "string", | ||
35 | + } | ||
36 | + httpExpect.POST("/notice-personal/credit-account/dividends-estimate"). | ||
37 | + WithJSON(body). | ||
38 | + Expect(). | ||
39 | + Status(http.StatusOK). | ||
40 | + JSON(). | ||
41 | + Object(). | ||
42 | + ContainsKey("code").ValueEqual("code", 0). | ||
43 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
44 | + ContainsKey("data").Value("data").Object() | ||
45 | + }) | ||
46 | + }) | ||
47 | + }) | ||
48 | + AfterEach(func() { | ||
49 | + _, err := pG.DB.Exec("DELETE FROM notice_personals WHERE true") | ||
50 | + Expect(err).NotTo(HaveOccurred()) | ||
51 | + }) | ||
52 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("设置消息:共创申请审核通过", func() { | ||
13 | + var noticePersonalId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬icePersonalId), | ||
17 | + "INSERT INTO notice_personals (created_at, deleted_at, updated_at, extend, company_id, content, is_read, module, module_action, notice_personal_id, org_id, sys_code, user_id, user_base_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_personal_id", | ||
18 | + "testCreatedAt", "testDeletedAt", "testUpdatedAt", "testExtend", "testCompanyId", "testContent", "testIsRead", "testModule", "testModuleAction", "testNoticePersonalId", "testOrgId", "testSysCode", "testUserId", "testUserBaseId") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("设置消息:共创申请审核通过", func() { | ||
22 | + Context("", func() { | ||
23 | + It("", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "userId": "int64", | ||
27 | + "userBaseId": "int64", | ||
28 | + "orgId": "int64", | ||
29 | + "companyId": "int64", | ||
30 | + "creditAccountOrderNum": "string", | ||
31 | + "settlementAmount": "string", | ||
32 | + "creditAccountId": "int64", | ||
33 | + "actuallyPaidAmount": "string", | ||
34 | + } | ||
35 | + httpExpect.POST("/notice-personal/notice-personal/credit-account/payment"). | ||
36 | + WithJSON(body). | ||
37 | + Expect(). | ||
38 | + Status(http.StatusOK). | ||
39 | + JSON(). | ||
40 | + Object(). | ||
41 | + ContainsKey("code").ValueEqual("code", 0). | ||
42 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
43 | + ContainsKey("data").Value("data").Object() | ||
44 | + }) | ||
45 | + }) | ||
46 | + }) | ||
47 | + AfterEach(func() { | ||
48 | + _, err := pG.DB.Exec("DELETE FROM notice_personals WHERE true") | ||
49 | + Expect(err).NotTo(HaveOccurred()) | ||
50 | + }) | ||
51 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("获取消息列表", func() { | ||
13 | + var noticePersonalId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬icePersonalId), | ||
17 | + "INSERT INTO notice_personals (created_at, deleted_at, updated_at, extend, company_id, content, is_read, module, module_action, notice_personal_id, org_id, sys_code, user_id, user_base_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_personal_id", | ||
18 | + "testCreatedAt", "testDeletedAt", "testUpdatedAt", "testExtend", "testCompanyId", "testContent", "testIsRead", "testModule", "testModuleAction", "testNoticePersonalId", "testOrgId", "testSysCode", "testUserId", "testUserBaseId") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("获取消息列表", func() { | ||
22 | + Context("", func() { | ||
23 | + It("", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "userId": "int64", | ||
27 | + "offset": "int64", | ||
28 | + "limit": "int64", | ||
29 | + "isRead": "int64", | ||
30 | + } | ||
31 | + httpExpect.POST("/notice-personal/"). | ||
32 | + WithJSON(body). | ||
33 | + Expect(). | ||
34 | + Status(http.StatusOK). | ||
35 | + JSON(). | ||
36 | + Object(). | ||
37 | + ContainsKey("code").ValueEqual("code", 0). | ||
38 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
39 | + ContainsKey("data").Value("data").Object() | ||
40 | + }) | ||
41 | + }) | ||
42 | + }) | ||
43 | + AfterEach(func() { | ||
44 | + _, err := pG.DB.Exec("DELETE FROM notice_personals WHERE true") | ||
45 | + Expect(err).NotTo(HaveOccurred()) | ||
46 | + }) | ||
47 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("设置消息:分红预算消息", func() { | ||
13 | + var noticePersonalId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬icePersonalId), | ||
17 | + "INSERT INTO notice_personals (created_at, deleted_at, updated_at, extend, company_id, content, is_read, module, module_action, notice_personal_id, org_id, sys_code, user_id, user_base_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_personal_id", | ||
18 | + "testCreatedAt", "testDeletedAt", "testUpdatedAt", "testExtend", "testCompanyId", "testContent", "testIsRead", "testModule", "testModuleAction", "testNoticePersonalId", "testOrgId", "testSysCode", "testUserId", "testUserBaseId") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("设置消息:分红预算消息", func() { | ||
22 | + Context("", func() { | ||
23 | + It("", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "userId": "int64", | ||
27 | + "userBaseId": "int64", | ||
28 | + "orgId": "int64", | ||
29 | + "companyId": "int64", | ||
30 | + "creationProjectId": "int64", | ||
31 | + "creationProjectName": "string", | ||
32 | + "creationContractId": "int64", | ||
33 | + "creationContractName": "string", | ||
34 | + "creationContractNumber": "string", | ||
35 | + "productName": "string", | ||
36 | + } | ||
37 | + httpExpect.POST("/notice-personal/inform-expected-dividends"). | ||
38 | + WithJSON(body). | ||
39 | + Expect(). | ||
40 | + Status(http.StatusOK). | ||
41 | + JSON(). | ||
42 | + Object(). | ||
43 | + ContainsKey("code").ValueEqual("code", 0). | ||
44 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
45 | + ContainsKey("data").Value("data").Object() | ||
46 | + }) | ||
47 | + }) | ||
48 | + }) | ||
49 | + AfterEach(func() { | ||
50 | + _, err := pG.DB.Exec("DELETE FROM notice_personals WHERE true") | ||
51 | + Expect(err).NotTo(HaveOccurred()) | ||
52 | + }) | ||
53 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("设置消息:共创确认", func() { | ||
13 | + var noticePersonalId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬icePersonalId), | ||
17 | + "INSERT INTO notice_personals (created_at, deleted_at, updated_at, extend, company_id, content, is_read, module, module_action, notice_personal_id, org_id, sys_code, user_id, user_base_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_personal_id", | ||
18 | + "testCreatedAt", "testDeletedAt", "testUpdatedAt", "testExtend", "testCompanyId", "testContent", "testIsRead", "testModule", "testModuleAction", "testNoticePersonalId", "testOrgId", "testSysCode", "testUserId", "testUserBaseId") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("设置消息:共创确认", func() { | ||
22 | + Context("", func() { | ||
23 | + It("", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "userId": "int64", | ||
27 | + "userBaseId": "int64", | ||
28 | + "orgId": "int64", | ||
29 | + "companyId": "int64", | ||
30 | + "creationProjectId": "int64", | ||
31 | + "creationProjectName": "string", | ||
32 | + "creationContractId": "int64", | ||
33 | + "creationContractName": "string", | ||
34 | + "creationContractNumber": "string", | ||
35 | + } | ||
36 | + httpExpect.POST("/notice-personal/inform-join-creation-contract"). | ||
37 | + WithJSON(body). | ||
38 | + Expect(). | ||
39 | + Status(http.StatusOK). | ||
40 | + JSON(). | ||
41 | + Object(). | ||
42 | + ContainsKey("code").ValueEqual("code", 0). | ||
43 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
44 | + ContainsKey("data").Value("data").Object() | ||
45 | + }) | ||
46 | + }) | ||
47 | + }) | ||
48 | + AfterEach(func() { | ||
49 | + _, err := pG.DB.Exec("DELETE FROM notice_personals WHERE true") | ||
50 | + Expect(err).NotTo(HaveOccurred()) | ||
51 | + }) | ||
52 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + "net/http/httptest" | ||
6 | + "testing" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/server/web" | ||
9 | + . "github.com/onsi/ginkgo" | ||
10 | + . "github.com/onsi/gomega" | ||
11 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
12 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/port/beego" | ||
13 | +) | ||
14 | + | ||
15 | +func TestNoticePersonal(t *testing.T) { | ||
16 | + RegisterFailHandler(Fail) | ||
17 | + RunSpecs(t, "Beego Port NoticePersonal Correlations Test Case Suite") | ||
18 | +} | ||
19 | + | ||
20 | +var handler http.Handler | ||
21 | +var server *httptest.Server | ||
22 | + | ||
23 | +var _ = BeforeSuite(func() { | ||
24 | + handler = web.BeeApp.Handlers | ||
25 | + server = httptest.NewServer(handler) | ||
26 | +}) | ||
27 | + | ||
28 | +var _ = AfterSuite(func() { | ||
29 | + server.Close() | ||
30 | +}) |
1 | +package notice_personal | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("设置消息:共创申请审核拒绝", func() { | ||
13 | + var noticePersonalId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬icePersonalId), | ||
17 | + "INSERT INTO notice_personals (created_at, deleted_at, updated_at, extend, company_id, content, is_read, module, module_action, notice_personal_id, org_id, sys_code, user_id, user_base_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_personal_id", | ||
18 | + "testCreatedAt", "testDeletedAt", "testUpdatedAt", "testExtend", "testCompanyId", "testContent", "testIsRead", "testModule", "testModuleAction", "testNoticePersonalId", "testOrgId", "testSysCode", "testUserId", "testUserBaseId") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("设置消息:共创申请审核拒绝", func() { | ||
22 | + Context("", func() { | ||
23 | + It("", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "userId": "int64", | ||
27 | + "userBaseId": "int64", | ||
28 | + "orgId": "int64", | ||
29 | + "companyId": "int64", | ||
30 | + "creationProjectId": "int64", | ||
31 | + "creationProjectName": "string", | ||
32 | + "creationProjectNumber": "string", | ||
33 | + } | ||
34 | + httpExpect.POST("/notice-personal/refuse-join-creation-project"). | ||
35 | + WithJSON(body). | ||
36 | + Expect(). | ||
37 | + Status(http.StatusOK). | ||
38 | + JSON(). | ||
39 | + Object(). | ||
40 | + ContainsKey("code").ValueEqual("code", 0). | ||
41 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
42 | + ContainsKey("data").Value("data").Object() | ||
43 | + }) | ||
44 | + }) | ||
45 | + }) | ||
46 | + AfterEach(func() { | ||
47 | + _, err := pG.DB.Exec("DELETE FROM notice_personals WHERE true") | ||
48 | + Expect(err).NotTo(HaveOccurred()) | ||
49 | + }) | ||
50 | +}) |
1 | +package notice_setting | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("返回编排消息通知内容", func() { | ||
13 | + var noticeSettingId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬iceSettingId), | ||
17 | + "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, sys_code, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", | ||
18 | + "testCompanyId", "testContent", "testIsPush", "testModule", "testModuleAction", "testNoticeSettingId", "testOrgId", "testSysCode", "testCreatedAt", "testDeletedAt", "testUpdatedAt") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("根据noticeSettingId参数返回编排消息通知内容", func() { | ||
22 | + Context("传入有效的noticeSettingId", func() { | ||
23 | + It("返回编排消息通知内容数据", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + httpExpect.GET("/notice-setting/{Id}"). | ||
26 | + Expect(). | ||
27 | + Status(http.StatusOK). | ||
28 | + JSON(). | ||
29 | + Object(). | ||
30 | + ContainsKey("code").ValueEqual("code", 0). | ||
31 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
32 | + ContainsKey("data").Value("data").Object() | ||
33 | + }) | ||
34 | + }) | ||
35 | + }) | ||
36 | + AfterEach(func() { | ||
37 | + _, err := pG.DB.Exec("DELETE FROM notice_settings WHERE true") | ||
38 | + Expect(err).NotTo(HaveOccurred()) | ||
39 | + }) | ||
40 | +}) |
1 | +package notice_setting | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("返回编排消息通知内容列表", func() { | ||
13 | + var noticeSettingId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬iceSettingId), | ||
17 | + "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, sys_code, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", | ||
18 | + "testCompanyId", "testContent", "testIsPush", "testModule", "testModuleAction", "testNoticeSettingId", "testOrgId", "testSysCode", "testCreatedAt", "testDeletedAt", "testUpdatedAt") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("根据参数返回编排消息通知内容列表", func() { | ||
22 | + Context("传入有效的参数", func() { | ||
23 | + It("返回编排消息通知内容数据列表", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + httpExpect.GET("/notice-setting/"). | ||
26 | + Expect(). | ||
27 | + Status(http.StatusOK). | ||
28 | + JSON(). | ||
29 | + Object(). | ||
30 | + ContainsKey("code").ValueEqual("code", 0). | ||
31 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
32 | + ContainsKey("data").Value("data").Object(). | ||
33 | + ContainsKey("count").ValueEqual("count", 1). | ||
34 | + ContainsKey("noticeSettings").Value("noticeSettings").Array() | ||
35 | + }) | ||
36 | + }) | ||
37 | + }) | ||
38 | + AfterEach(func() { | ||
39 | + _, err := pG.DB.Exec("DELETE FROM notice_settings WHERE true") | ||
40 | + Expect(err).NotTo(HaveOccurred()) | ||
41 | + }) | ||
42 | +}) |
1 | +package notice_setting | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + "net/http/httptest" | ||
6 | + "testing" | ||
7 | + | ||
8 | + "github.com/beego/beego/v2/server/web" | ||
9 | + . "github.com/onsi/ginkgo" | ||
10 | + . "github.com/onsi/gomega" | ||
11 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
12 | + _ "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/port/beego" | ||
13 | +) | ||
14 | + | ||
15 | +func TestNoticeSetting(t *testing.T) { | ||
16 | + RegisterFailHandler(Fail) | ||
17 | + RunSpecs(t, "Beego Port NoticeSetting Correlations Test Case Suite") | ||
18 | +} | ||
19 | + | ||
20 | +var handler http.Handler | ||
21 | +var server *httptest.Server | ||
22 | + | ||
23 | +var _ = BeforeSuite(func() { | ||
24 | + handler = web.BeeApp.Handlers | ||
25 | + server = httptest.NewServer(handler) | ||
26 | +}) | ||
27 | + | ||
28 | +var _ = AfterSuite(func() { | ||
29 | + server.Close() | ||
30 | +}) |
1 | +package notice_setting | ||
2 | + | ||
3 | +import ( | ||
4 | + "net/http" | ||
5 | + | ||
6 | + "github.com/gavv/httpexpect" | ||
7 | + . "github.com/onsi/ginkgo" | ||
8 | + . "github.com/onsi/gomega" | ||
9 | + pG "gitlab.fjmaimaimai.com/allied-creation/allied-creation-basic/pkg/infrastructure/pg" | ||
10 | +) | ||
11 | + | ||
12 | +var _ = Describe("更新编排消息通知内容", func() { | ||
13 | + var noticeSettingId int64 | ||
14 | + BeforeEach(func() { | ||
15 | + _, err := pG.DB.QueryOne( | ||
16 | + pg.Scan(¬iceSettingId), | ||
17 | + "INSERT INTO notice_settings (company_id, content, is_push, module, module_action, notice_setting_id, org_id, sys_code, created_at, deleted_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING notice_setting_id", | ||
18 | + "testCompanyId", "testContent", "testIsPush", "testModule", "testModuleAction", "testNoticeSettingId", "testOrgId", "testSysCode", "testCreatedAt", "testDeletedAt", "testUpdatedAt") | ||
19 | + Expect(err).NotTo(HaveOccurred()) | ||
20 | + }) | ||
21 | + Describe("提交数据更新编排消息通知内容", func() { | ||
22 | + Context("提交正确的编排消息通知内容数据", func() { | ||
23 | + It("返回更新后的编排消息通知内容数据", func() { | ||
24 | + httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
25 | + body := map[string]interface{}{ | ||
26 | + "companyId": "int64", | ||
27 | + "content": "string", | ||
28 | + "isPush": "int", | ||
29 | + "module": "string", | ||
30 | + "moduleAction": "string", | ||
31 | + "noticeSettingId": "int64", | ||
32 | + "orgId": "int64", | ||
33 | + "sysCode": "string", | ||
34 | + "createdAt": "datetime", | ||
35 | + "deletedAt": "datetime", | ||
36 | + "updatedAt": "datetime", | ||
37 | + } | ||
38 | + httpExpect.PUT("/notice-setting/{Id}"). | ||
39 | + WithJSON(body). | ||
40 | + Expect(). | ||
41 | + Status(http.StatusOK). | ||
42 | + JSON(). | ||
43 | + Object(). | ||
44 | + ContainsKey("code").ValueEqual("code", 0). | ||
45 | + ContainsKey("msg").ValueEqual("msg", "ok"). | ||
46 | + ContainsKey("data").Value("data").Object(). | ||
47 | + ContainsKey("noticeSettingId").ValueEqual("noticeSettingId", noticeSettingId) | ||
48 | + }) | ||
49 | + }) | ||
50 | + }) | ||
51 | + AfterEach(func() { | ||
52 | + _, err := pG.DB.Exec("DELETE FROM notice_settings WHERE true") | ||
53 | + Expect(err).NotTo(HaveOccurred()) | ||
54 | + }) | ||
55 | +}) |
-
请 注册 或 登录 后发表评论