func TestCaptchaAvailable(t *testing.T) {
	ts := createHttpServerTest(createMiddlewareHandler(middlewares.New(), New()))
	defer ts.Close()

	client := &http.Client{}
	response, err := client.Get(ts.URL)
	assert.NoError(t, err, "Should not contain any error.")

	buffer := new(bytes.Buffer)
	io.Copy(buffer, response.Body)
	assert.Contains(t, buffer.String(), "<img", "Should contain image tag.")
}
func TestFields(t *testing.T) {

	ts := createHttpServerTest(createMiddlewareHandler(middlewares.New(), New()))
	defer ts.Close()

	client := &http.Client{}
	response, err := client.Get(ts.URL)
	assert.NoError(t, err, "Should not contain any error.")

	buffer := new(bytes.Buffer)
	io.Copy(buffer, response.Body)
	assert.Contains(t, buffer.String(), "Enter your password", "Should contain field with Enter your password.")

}
Beispiel #3
0
func main() {

	logger.Println("Application starts.")
	// User all cpu cores
	runtime.GOMAXPROCS(runtime.NumCPU())

	n := negroni.Classic()
	for _, v := range middlewares.New() {
		n.Use(v)
	}
	n.UseHandler(controllers.Routes())

	// Run the application and listen the port
	fmt.Println(&buf)
	n.Run(":3000")
	//graceful.Run(":3000", 5*time.Second, n)

}