func TestShowCreatePage(t *testing.T) {
	r := httptest.NewRequest("GET", "/pages/create", nil)
	w := httptest.NewRecorder()
	err := resource.AddUserSessionCookie(w, r, 1)
	if err != nil {
		t.Fatalf("pageactions: error setting session %s", err)
	}
	err = HandleCreateShow(w, r)
	if err != nil || w.Code != http.StatusOK {
		t.Fatalf("pageactions: error handling HandleCreateShow %s", err)
	}
	pattern := "resource-update-form"
	if !strings.Contains(w.Body.String(), pattern) {
		t.Fatalf("pageactions: unexpected response for HandleCreateShow expected:%s got:%s", pattern, w.Body.String())
	}
}
Test GET /pages/create
package pageactions
import (
	"fmt"
	"net/http"
	"net/http/httptest"
	"net/url"
	"strings"
	"testing"
	"github.com/fragmenta/mux"
	"github.com/fragmenta/query"
	"github.com/fragmenta/fragmenta-cms/src/lib/resource"
	"github.com/fragmenta/fragmenta-cms/src/pages"
)
var names = []string{"foo", "bar"}
func TestSetup(t *testing.T) {
	err := resource.SetupTestDatabase(3)
	if err != nil {
		fmt.Printf("pages: Setup db failed %s", err)
	}
	resource.SetupAuthorisation()
	resource.SetupView(3)
	router := mux.New()
	mux.SetDefault(router)
	router.Add("/pages", nil)
	router.Add("/pages/create", nil)
	router.Add("/pages/create", nil).Post()
	router.Add("/pages/login", nil)
	router.Add("/pages/login", nil).Post()
	router.Add("/pages/login", nil).Post()
	router.Add("/pages/logout", nil).Post()
	router.Add("/pages/{id:\\d+}/update", nil)
	router.Add("/pages/{id:\\d+}/update", nil).Post()
	router.Add("/pages/{id:\\d+}/destroy", nil).Post()
	router.Add("/pages/{id:\\d+}", nil)
	query.ExecSQL("delete from pages;")
	query.ExecSQL("ALTER SEQUENCE pages_id_seq RESTART WITH 1;")
}