正在显示
7 个修改的文件
包含
0 行增加
和
265 行删除
| @@ -3,31 +3,10 @@ module gitlab.fjmaimaimai.com/mmm-go/partner | @@ -3,31 +3,10 @@ module gitlab.fjmaimaimai.com/mmm-go/partner | ||
| 3 | go 1.14 | 3 | go 1.14 |
| 4 | 4 | ||
| 5 | require ( | 5 | require ( |
| 6 | - github.com/ajg/form v1.5.1 // indirect | ||
| 7 | github.com/astaxie/beego v1.12.1 | 6 | github.com/astaxie/beego v1.12.1 |
| 8 | github.com/dgrijalva/jwt-go v3.2.0+incompatible | 7 | github.com/dgrijalva/jwt-go v3.2.0+incompatible |
| 9 | - github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect | ||
| 10 | - github.com/fatih/structs v1.1.0 // indirect | ||
| 11 | - github.com/gavv/httpexpect v2.0.0+incompatible | ||
| 12 | github.com/go-pg/pg/v10 v10.0.0-beta.2 | 8 | github.com/go-pg/pg/v10 v10.0.0-beta.2 |
| 13 | - github.com/google/go-querystring v1.0.0 // indirect | ||
| 14 | - github.com/gorilla/websocket v1.4.2 // indirect | ||
| 15 | - github.com/imkira/go-interpol v1.1.0 // indirect | ||
| 16 | - github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect | ||
| 17 | github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9 | 9 | github.com/linmadan/egglib-go v0.0.0-20191217144343-ca4539f95bf9 |
| 18 | - github.com/mattn/go-colorable v0.1.6 // indirect | ||
| 19 | - github.com/moul/http2curl v1.0.0 // indirect | ||
| 20 | - github.com/onsi/ginkgo v1.10.3 | ||
| 21 | - github.com/onsi/gomega v1.7.1 | ||
| 22 | - github.com/sergi/go-diff v1.1.0 // indirect | ||
| 23 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect | 10 | github.com/shiena/ansicolor v0.0.0-20151119151921-a422bbe96644 // indirect |
| 24 | - github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726 | ||
| 25 | - github.com/smartystreets/goconvey v1.6.4 // indirect | ||
| 26 | github.com/tiptok/gocomm v0.0.0-20190919092013-c230743f8095 | 11 | github.com/tiptok/gocomm v0.0.0-20190919092013-c230743f8095 |
| 27 | - github.com/valyala/fasthttp v1.14.0 // indirect | ||
| 28 | - github.com/xeipuuv/gojsonschema v1.2.0 // indirect | ||
| 29 | - github.com/yalp/jsonpath v0.0.0-20180802001716-5cc68e5049a0 // indirect | ||
| 30 | - github.com/yudai/gojsondiff v1.0.0 // indirect | ||
| 31 | - github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect | ||
| 32 | - github.com/yudai/pp v2.0.1+incompatible // indirect | ||
| 33 | ) | 12 | ) |
| 1 | -package partnerInfo | ||
| 2 | - | ||
| 3 | -import ( | ||
| 4 | - "github.com/gavv/httpexpect" | ||
| 5 | - . "github.com/onsi/ginkgo" | ||
| 6 | - . "github.com/onsi/gomega" | ||
| 7 | - pG "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg" | ||
| 8 | - "net/http" | ||
| 9 | -) | ||
| 10 | - | ||
| 11 | -var _ = Describe("创建新合伙人", func() { | ||
| 12 | - Describe("创建新合伙人", func() { | ||
| 13 | - Context("创建新合伙人", func() { | ||
| 14 | - It("返回合伙人数据", func() { | ||
| 15 | - httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
| 16 | - body := map[string]interface{}{ | ||
| 17 | - "partnerName": "employeeName", | ||
| 18 | - "account": "account123", | ||
| 19 | - "password": "password", | ||
| 20 | - "status": 1, | ||
| 21 | - "partnerCategory": 1, | ||
| 22 | - //"createAt":time.Now(), | ||
| 23 | - //"updateAt":time.Now(), | ||
| 24 | - "salesman": []map[string]interface{}{ | ||
| 25 | - {"name": "name", "telephone": "18860183051"}, | ||
| 26 | - {"name2": "name", "telephone": "18860183052j"}, | ||
| 27 | - }, | ||
| 28 | - } | ||
| 29 | - httpExpect.POST("/partnerInfos"). | ||
| 30 | - WithJSON(body). | ||
| 31 | - Expect(). | ||
| 32 | - Status(http.StatusOK). | ||
| 33 | - JSON(). | ||
| 34 | - Object(). | ||
| 35 | - ContainsKey("code").ValueEqual("code", 0). | ||
| 36 | - ContainsKey("msg").ValueEqual("msg", "ok"). | ||
| 37 | - ContainsKey("data").Value("data").Object(). | ||
| 38 | - ContainsKey("id").ValueNotEqual("id", BeZero()) | ||
| 39 | - }) | ||
| 40 | - }) | ||
| 41 | - }) | ||
| 42 | - AfterEach(func() { | ||
| 43 | - _, err := pG.DB.Exec("DELETE FROM partner_infos WHERE true") | ||
| 44 | - Expect(err).NotTo(HaveOccurred()) | ||
| 45 | - }) | ||
| 46 | -}) |
| 1 | -package partnerInfo | ||
| 2 | - | ||
| 3 | -import ( | ||
| 4 | - "github.com/gavv/httpexpect" | ||
| 5 | - . "github.com/onsi/ginkgo" | ||
| 6 | - . "github.com/onsi/gomega" | ||
| 7 | - pG "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg" | ||
| 8 | - "net/http" | ||
| 9 | -) | ||
| 10 | - | ||
| 11 | -var _ = Describe("删除合伙人", func() { | ||
| 12 | - BeforeEach(func() { | ||
| 13 | - _, err := pG.DB.Exec(`INSERT INTO "public"."partner_infos"("id", "partner_name", "account", "password", "status", "partner_category", "create_at", "update_at", "salesman") VALUES (2929531956394199040, 'employeeName', 'account', 'password', 1, 1, '2020-06-19 15:23:31.616934+08', '2020-06-19 15:23:31.616934+08', '[{"name": "name", "telephone": "18860183051"}, {"name": "", "telephone": "18860183052j"}]');`) | ||
| 14 | - Expect(err).NotTo(HaveOccurred()) | ||
| 15 | - }) | ||
| 16 | - Describe("删除合伙人", func() { | ||
| 17 | - Context("删除合伙人", func() { | ||
| 18 | - It("删除合伙人数据", func() { | ||
| 19 | - httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
| 20 | - body := map[string]interface{}{} | ||
| 21 | - httpExpect.DELETE("/partnerInfos/2929531956394199040"). | ||
| 22 | - WithJSON(body). | ||
| 23 | - Expect(). | ||
| 24 | - Status(http.StatusOK). | ||
| 25 | - JSON(). | ||
| 26 | - Object(). | ||
| 27 | - ContainsKey("code").ValueEqual("code", 0). | ||
| 28 | - ContainsKey("msg").ValueEqual("msg", "ok"). | ||
| 29 | - ContainsKey("data").Value("data").Object(). | ||
| 30 | - ContainsKey("id").ValueNotEqual("id", BeZero()) | ||
| 31 | - }) | ||
| 32 | - }) | ||
| 33 | - }) | ||
| 34 | - AfterEach(func() { | ||
| 35 | - _, err := pG.DB.Exec("DELETE FROM partner_infos WHERE true") | ||
| 36 | - Expect(err).NotTo(HaveOccurred()) | ||
| 37 | - }) | ||
| 38 | -}) |
| 1 | -package partnerInfo | ||
| 2 | - | ||
| 3 | -import ( | ||
| 4 | - "github.com/gavv/httpexpect" | ||
| 5 | - . "github.com/onsi/ginkgo" | ||
| 6 | - . "github.com/onsi/gomega" | ||
| 7 | - pG "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg" | ||
| 8 | - "net/http" | ||
| 9 | -) | ||
| 10 | - | ||
| 11 | -var _ = Describe("获取合伙人", func() { | ||
| 12 | - BeforeEach(func() { | ||
| 13 | - _, err := pG.DB.Exec(`INSERT INTO "public"."partner_infos"("id", "partner_name", "account", "password", "status", "partner_category", "create_at", "update_at", "salesman") VALUES (2929531956394199040, 'employeeName', 'account', 'password', 1, 1, '2020-06-19 15:23:31.616934+08', '2020-06-19 15:23:31.616934+08', '[{"name": "name", "telephone": "18860183051"}, {"name": "", "telephone": "18860183052j"}]');`) | ||
| 14 | - Expect(err).NotTo(HaveOccurred()) | ||
| 15 | - }) | ||
| 16 | - Describe("获取合伙人", func() { | ||
| 17 | - Context("获取合伙人", func() { | ||
| 18 | - It("返回合伙人数据", func() { | ||
| 19 | - httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
| 20 | - body := map[string]interface{}{} | ||
| 21 | - httpExpect.GET("/partnerInfos/2929531956394199040"). | ||
| 22 | - WithJSON(body). | ||
| 23 | - Expect(). | ||
| 24 | - Status(http.StatusOK). | ||
| 25 | - JSON(). | ||
| 26 | - Object(). | ||
| 27 | - ContainsKey("code").ValueEqual("code", 0). | ||
| 28 | - ContainsKey("msg").ValueEqual("msg", "ok"). | ||
| 29 | - ContainsKey("data").Value("data").Object(). | ||
| 30 | - ContainsKey("id").ValueNotEqual("id", BeZero()) | ||
| 31 | - }) | ||
| 32 | - }) | ||
| 33 | - }) | ||
| 34 | - AfterEach(func() { | ||
| 35 | - _, err := pG.DB.Exec("DELETE FROM partner_infos WHERE true") | ||
| 36 | - Expect(err).NotTo(HaveOccurred()) | ||
| 37 | - }) | ||
| 38 | -}) |
| 1 | -package partnerInfo | ||
| 2 | - | ||
| 3 | -import ( | ||
| 4 | - "github.com/gavv/httpexpect" | ||
| 5 | - . "github.com/onsi/ginkgo" | ||
| 6 | - . "github.com/onsi/gomega" | ||
| 7 | - pG "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg" | ||
| 8 | - "net/http" | ||
| 9 | -) | ||
| 10 | - | ||
| 11 | -var _ = Describe("获取合伙人列表", func() { | ||
| 12 | - BeforeEach(func() { | ||
| 13 | - _, err := pG.DB.Exec(`INSERT INTO "public"."partner_infos"("id", "partner_name", "account", "password", "status", "partner_category", "create_at", "update_at", "salesman") VALUES (2929531956394199040, 'employeeName', 'account', 'password', 1, 1, '2020-06-19 15:23:31.616934+08', '2020-06-19 15:23:31.616934+08', '[{"name": "name", "telephone": "18860183051"}, {"name": "", "telephone": "18860183052j"}]');`) | ||
| 14 | - Expect(err).NotTo(HaveOccurred()) | ||
| 15 | - }) | ||
| 16 | - Describe("获取合伙人列表", func() { | ||
| 17 | - Context("获取合伙人列表", func() { | ||
| 18 | - It("获取合伙人列表", func() { | ||
| 19 | - httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
| 20 | - body := map[string]interface{}{} | ||
| 21 | - httpExpect.GET("/partnerInfos"). | ||
| 22 | - WithQuery("partnerCategory", 1). | ||
| 23 | - WithQuery("status", 1). | ||
| 24 | - WithQuery("status", 1). | ||
| 25 | - WithQuery("sortByCreateTime", "DESC"). | ||
| 26 | - WithQuery("sortByUpdateTime", "DESC"). | ||
| 27 | - WithQuery("offset", 0). | ||
| 28 | - WithQuery("limit", 20). | ||
| 29 | - WithJSON(body). | ||
| 30 | - Expect(). | ||
| 31 | - Status(http.StatusOK). | ||
| 32 | - JSON(). | ||
| 33 | - Object(). | ||
| 34 | - ContainsKey("code").ValueEqual("code", 0). | ||
| 35 | - ContainsKey("msg").ValueEqual("msg", "ok"). | ||
| 36 | - ContainsKey("data").Value("data").Object().ContainsKey("partnerInfos") | ||
| 37 | - }) | ||
| 38 | - }) | ||
| 39 | - }) | ||
| 40 | - AfterEach(func() { | ||
| 41 | - _, err := pG.DB.Exec("DELETE FROM partner_infos WHERE true") | ||
| 42 | - Expect(err).NotTo(HaveOccurred()) | ||
| 43 | - }) | ||
| 44 | -}) |
| 1 | -package partnerInfo | ||
| 2 | - | ||
| 3 | -import ( | ||
| 4 | - "github.com/astaxie/beego" | ||
| 5 | - . "github.com/onsi/ginkgo" | ||
| 6 | - . "github.com/onsi/gomega" | ||
| 7 | - "net/http" | ||
| 8 | - "net/http/httptest" | ||
| 9 | - "testing" | ||
| 10 | - | ||
| 11 | - _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg" | ||
| 12 | - _ "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/port/beego" | ||
| 13 | -) | ||
| 14 | - | ||
| 15 | -func TestPartnerInfo(t *testing.T) { | ||
| 16 | - RegisterFailHandler(Fail) | ||
| 17 | - RunSpecs(t, "Beego Port Employee Correlations Test Case Suite") | ||
| 18 | -} | ||
| 19 | - | ||
| 20 | -var handler http.Handler | ||
| 21 | -var server *httptest.Server | ||
| 22 | - | ||
| 23 | -var _ = BeforeSuite(func() { | ||
| 24 | - handler = beego.BeeApp.Handlers | ||
| 25 | - server = httptest.NewServer(handler) | ||
| 26 | -}) | ||
| 27 | - | ||
| 28 | -var _ = AfterSuite(func() { | ||
| 29 | - server.Close() | ||
| 30 | -}) |
| 1 | -package partnerInfo | ||
| 2 | - | ||
| 3 | -import ( | ||
| 4 | - "github.com/gavv/httpexpect" | ||
| 5 | - . "github.com/onsi/ginkgo" | ||
| 6 | - . "github.com/onsi/gomega" | ||
| 7 | - pG "gitlab.fjmaimaimai.com/mmm-go/partner/pkg/infrastructure/pg" | ||
| 8 | - "net/http" | ||
| 9 | -) | ||
| 10 | - | ||
| 11 | -var _ = Describe("创建新合伙人", func() { | ||
| 12 | - BeforeEach(func() { | ||
| 13 | - _, err := pG.DB.Exec(`INSERT INTO "public"."partner_infos"("id", "partner_name", "account", "password", "status", "partner_category", "create_at", "update_at", "salesman") VALUES (2929531956394199040, 'employeeName', 'account', 'password', 1, 1, '2020-06-19 15:23:31.616934+08', '2020-06-19 15:23:31.616934+08', '[{"name": "name", "telephone": "18860183051"}, {"name": "", "telephone": "18860183052j"}]');`) | ||
| 14 | - Expect(err).NotTo(HaveOccurred()) | ||
| 15 | - }) | ||
| 16 | - Describe("创建新合伙人", func() { | ||
| 17 | - Context("创建新合伙人", func() { | ||
| 18 | - It("返回合伙人数据", func() { | ||
| 19 | - httpExpect := httpexpect.New(GinkgoT(), server.URL) | ||
| 20 | - body := map[string]interface{}{ | ||
| 21 | - "partnerName": "employeeName", | ||
| 22 | - "account": "account123", | ||
| 23 | - "password": "password", | ||
| 24 | - "status": 1, | ||
| 25 | - "partnerCategory": 1, | ||
| 26 | - "salesman": []map[string]interface{}{ | ||
| 27 | - {"name": "name", "telephone": "18860183051"}, | ||
| 28 | - {"name2": "name", "telephone": "18860183052j"}, | ||
| 29 | - }, | ||
| 30 | - } | ||
| 31 | - httpExpect.PUT("/partnerInfos/2929531956394199040"). | ||
| 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 | - ContainsKey("id").ValueNotEqual("id", BeZero()) | ||
| 41 | - }) | ||
| 42 | - }) | ||
| 43 | - }) | ||
| 44 | - AfterEach(func() { | ||
| 45 | - _, err := pG.DB.Exec("DELETE FROM partner_infos WHERE true") | ||
| 46 | - Expect(err).NotTo(HaveOccurred()) | ||
| 47 | - }) | ||
| 48 | -}) |
-
请 注册 或 登录 后发表评论