func TestAllwaysAllowNone(t *testing.T) {
	e := fmt.Errorf("myError")
	handler := booking_handler_mock.New()
	r := New(createVerifyLogin(false, nil), createHasRole(false, e), createHttpRequestToAuthentication(nil, e), booking_authorization.None, handler)
	if err := AssertThat(r.checkPermission(&http.Request{}), NilValue()); err != nil {
		t.Fatal(err)
	}
}
func TestHasRoleReturnFalse(t *testing.T) {
	handler := booking_handler_mock.New()
	r := New(createVerifyLogin(false, nil), createHasRole(false, nil), createHttpRequestToAuthentication(nil, nil), booking_authorization.Administrator, handler)
	if err := AssertThat(r.ServeHTTP(server_mock.NewHttpResponseWriterMock(), &http.Request{}), NotNilValue()); err != nil {
		t.Fatal(err)
	}
	if err := AssertThat(handler.Request == nil, Is(true)); err != nil {
		t.Fatal(err)
	}
	if err := AssertThat(handler.Response == nil, Is(true)); err != nil {
		t.Fatal(err)
	}
}
func TestHasRoleFailed(t *testing.T) {
	e := fmt.Errorf("myError")
	handler := booking_handler_mock.New()
	r := New(createVerifyLogin(true, nil), createHasRole(true, e), createHttpRequestToAuthentication(nil, nil), booking_authorization.Administrator, handler)
	if err := AssertThat(r.ServeHTTP(server_mock.NewHttpResponseWriterMock(), &http.Request{}), Is(e)); err != nil {
		t.Fatal(err)
	}
	if err := AssertThat(handler.Request == nil, Is(true)); err != nil {
		t.Fatal(err)
	}
	if err := AssertThat(handler.Response == nil, Is(true)); err != nil {
		t.Fatal(err)
	}
}