github.com/kotovmak/go-admin@v1.1.1/tests/common/normal.go (about) 1 package common 2 3 import ( 4 "fmt" 5 "net/http" 6 7 "github.com/gavv/httpexpect" 8 "github.com/kotovmak/go-admin/modules/config" 9 ) 10 11 func normalTest(e *httpexpect.Expect, sesID *http.Cookie) { 12 13 fmt.Println() 14 printlnWithColor("Normal Table", "blue") 15 fmt.Println("============================") 16 17 // show 18 19 printlnWithColor("show", "green") 20 e.GET(config.Url("/info/user")). 21 WithCookie(sesID.Name, sesID.Value). 22 Expect(). 23 Status(200). 24 Body().Contains("Users") 25 26 // export 27 28 printlnWithColor("export test", "green") 29 e.POST(config.Url("/export/user")). 30 WithCookie(sesID.Name, sesID.Value). 31 WithMultipart(). 32 WithFormField("id", "1"). 33 Expect().Status(200) 34 35 // show form: without id 36 37 //printlnWithColor("show form: without id", "green") 38 //e.GET(config.Url("/info/user/edit")). 39 // WithCookie(sesID.Name, sesID.Value). 40 // Expect().Status(200).Body().Contains(errors.WrongID) 41 42 // show form 43 44 //printlnWithColor("show form", "green") 45 //e.GET(config.Url("/info/user/edit")). 46 // WithQuery(constant.EditPKKey, "362"). 47 // WithCookie(sesID.Name, sesID.Value). 48 // Expect().Status(200).Body() 49 50 // show new form 51 52 printlnWithColor("show new form", "green") 53 e.GET(config.Url("/info/user/new")). 54 WithCookie(sesID.Name, sesID.Value). 55 Expect().Status(200).Body() 56 57 }