(t *testing.T)
| 15 | const pageAddress = "127.0.0.1:10087" |
| 16 | |
| 17 | func TestPrintPage(t *testing.T) { |
| 18 | |
| 19 | p := peer.NewGenericPeer("http.Acceptor", "httpserver", pageAddress, nil) |
| 20 | |
| 21 | proc.BindProcessorHandler(p, "http", func(raw cellnet.Event) { |
| 22 | |
| 23 | switch { |
| 24 | case raw.Session().(httppeer.RequestMatcher).Match("GET", "/"): |
| 25 | |
| 26 | raw.Session().Send(&httppeer.HTMLRespond{ |
| 27 | StatusCode: http.StatusOK, |
| 28 | PageTemplate: "index", |
| 29 | TemplateModel: "world", |
| 30 | }) |
| 31 | } |
| 32 | |
| 33 | }) |
| 34 | |
| 35 | p.Start() |
| 36 | |
| 37 | validPage(t, fmt.Sprintf("http://%s", pageAddress), "<h1>Hello world</h1>") |
| 38 | |
| 39 | p.Stop() |
| 40 | |
| 41 | } |
| 42 | |
| 43 | func validPage(t *testing.T, url, expectAck string) { |
| 44 | c := &http.Client{ |
nothing calls this directly
no test coverage detected