You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: cache_test.go
    path of file: ./repos/pagoda/pkg/middleware
    
    the code of the file until where you have to start completion: package middleware

import (
	"context"
	"net/http"
	"testing"
	"time"

	"github.com/mikestefanello/pagoda/pkg/tests"

	"github.com/stretchr/testify/require"

	"github.com/stretchr/testify/assert"
)

func TestServeCachedPage(t *testing.T) {
	// Cache a p
    
func TestServeCachedPage(t *testing.T) {
	// Cache a page
	cp := CachedPage{
		URL:        "/cache",
		HTML:       []byte("html"),
		Headers:    make(map[string]string),
		StatusCode: http.StatusCreated,
	}
	cp.Headers["a"] = "b"
	cp.Headers["c"] = "d"

	err := c.Cache.
		Set().
		Group(CachedPageGroup).
		Key(cp.URL).
		Data(cp).
		Save(context.Background())
	require.NoError(t, err)

	// Request the URL of the cached page
	ctx, rec := tests.NewContext(c.Web, cp.URL)
	err = tests.ExecuteMiddleware(ctx, ServeCachedPage(c.Cache))
	assert.NoError(t, err)
	assert.Equal(t, cp.StatusCode, ctx.Response().Status)
	assert.Equal(t, cp.Headers["a"], ctx.Response().Header().Get("a"))
	assert.Equal(t, cp.Headers["c"], ctx.Response().Header().Get("c"))
	assert.Equal(t, cp.HTML, rec.Body.Bytes())

	// Login and try again
	tests.InitSession(ctx)
	err = c.Auth.Login(ctx, usr.ID)
	require.NoError(t, err)
	_ = tests.ExecuteMiddleware(ctx, LoadAuthenticatedUser(c.Auth))
	err = tests.ExecuteMiddleware(ctx, ServeCachedPage(c.Cache))
	assert.Nil(t, err)
}