Exemplo n.º 1
0
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.")
}
Exemplo n.º 2
0
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.")

}
Exemplo n.º 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)

}