File size: 1,188 Bytes
530729e |
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 common
import (
"fmt"
"net/http"
"github.com/GoAdminGroup/go-admin/modules/config"
"github.com/GoAdminGroup/go-admin/plugins/admin/modules/constant"
"github.com/gavv/httpexpect"
)
func externalTest(e *httpexpect.Expect, sesID *http.Cookie) {
fmt.Println()
printlnWithColor("External", "blue")
fmt.Println("============================")
// show
printlnWithColor("show", "green")
e.GET(config.Url("/info/external")).
WithCookie(sesID.Name, sesID.Value).
Expect().
Status(200).
Body().Contains("External").Contains("this is a title").Contains("10")
// show form: without id
//printlnWithColor("show form: without id", "green")
//e.GET(config.Url("/info/external/edit")).
// WithCookie(sesID.Name, sesID.Value).
// Expect().Status(200).Body().Contains(errors.WrongID)
// show form
printlnWithColor("show form", "green")
e.GET(config.Url("/info/external/edit")).
WithQuery(constant.EditPKKey, "10").
WithCookie(sesID.Name, sesID.Value).
Expect().Status(200).Body()
// show new form
printlnWithColor("show new form", "green")
e.GET(config.Url("/info/external/new")).
WithCookie(sesID.Name, sesID.Value).
Expect().Status(200).Body()
}
|