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: api_httpsig_test.go
    path of file: ./repos/gitea/tests/integration
    
    the code of the file until where you have to start completion: // Copyright 2022 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT

package integration

import (
	"encoding/base64"
	"net/http"
	"net/url"
	"testing"

	auth_model "code.gitea.io/gitea/models/auth"
	"code.gitea.io/gitea/modules/setting"
	api "code.gitea.io/gitea/modules/structs"
	"code.gitea.io/gitea/modules/test"
	"code.gitea.io/gitea/tests"

	"github.com/go-fed/httpsig"
	"golang.org/x/crypto/ssh"
)

const (
	httpsigPrivateKey = `-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEAqjmQeb5Eb1xV7qbNf9ErQ0XRvKZWzUsLFhJzZz+Ab7q8WtPs91vQ
fBiypw4i8OTG6WzDcgZaV8Ndxn7iHnIstdA1k89MVG4stydymmwmk9+mrCMNsu5OmdIy9F
AZ61RDcKuf5VG2WKkmeK0VO+OMJIYfE1C6czNeJ6UAmcIOmhGxvjM
    
func TestHTTPSigPubKey(t *testing.T) {
	// Add our public key to user1
	defer tests.PrepareTestEnv(t)()
	defer test.MockVariableValue(&setting.SSH.MinimumKeySizeCheck, false)()
	session := loginUser(t, "user1")
	token := url.QueryEscape(getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeWriteUser))
	keyType := "ssh-rsa"
	keyContent := "AAAAB3NzaC1yc2EAAAADAQABAAABAQCqOZB5vkRvXFXups1/0StDRdG8plbNSwsWEnNnP4Bvurxa0+z3W9B8GLKnDiLw5MbpbMNyBlpXw13GfuIeciy10DWTz0xUbiy3J3KabCaT36asIw2y7k6Z0jL0UBnrVENwq5/lUbZYqSZ4rRU744wkhh8TULpzM14npQCZwg6aEbG+MwjzddQ72fR+3BPBrKn5dTmmu8rH99O+U+Nuto81Tg7PA+NUupcHOmhdiEGq49plgVFXK98Vks5tiybL4GuzFyWgyX73Dg/QBMn2eMHt1EMv5Gs3i6GFhKKGo4rjDi9qI6PX5oDR4LTNe6cR8td8YhVD8WFZwLLl/vaYyIqd"
	rawKeyBody := api.CreateKeyOption{
		Title: "test-key",
		Key:   keyType + " " + keyContent,
	}
	req := NewRequestWithJSON(t, "POST", "/api/v1/user/keys", rawKeyBody).
		AddTokenAuth(token)
	MakeRequest(t, req, http.StatusCreated)

	// parse our private key and create the httpsig request
	sshSigner, _ := ssh.ParsePrivateKey([]byte(httpsigPrivateKey))
	keyID := ssh.FingerprintSHA256(sshSigner.PublicKey())

	// create the request
	token = getTokenForLoggedInUser(t, session, auth_model.AccessTokenScopeReadAdmin)
	req = NewRequest(t, "GET", "/api/v1/admin/users").
		AddTokenAuth(token)

	signer, _, err := httpsig.NewSSHSigner(sshSigner, httpsig.DigestSha512, []string{httpsig.RequestTarget, "(created)", "(expires)"}, httpsig.Signature, 10)
	if err != nil {
		t.Fatal(err)
	}

	// sign the request
	err = signer.SignRequest(keyID, req.Request, nil)
	if err != nil {
		t.Fatal(err)
	}

	// make the request
	MakeRequest(t, req, http.StatusOK)
}