gemtest

package
v0.0.0-...-d471ebf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2024 License: ISC Imports: 9 Imported by: 0

Documentation

Overview

Package gemtest contains utilities for writing tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRequest

func NewRequest(rawURL string) *gemproto.Request

Types

type ResponseRecorder

type ResponseRecorder struct {
	Body bytes.Buffer
	Code int
	Meta string
	// contains filtered or unexported fields
}

func NewRecorder

func NewRecorder() *ResponseRecorder

func (*ResponseRecorder) Write

func (r *ResponseRecorder) Write(p []byte) (int, error)

func (*ResponseRecorder) WriteHeader

func (r *ResponseRecorder) WriteHeader(statusCode int, meta string)

type Server

type Server struct {
	// Certificate is the temporary certificate.
	Certificate tls.Certificate

	// URL is the base URL to the server.
	URL string
	// contains filtered or unexported fields
}

Server is a temporary server suitable for writing tests.

func NewServer

func NewServer(h gemproto.Handler) *Server

NewServer creates a server initialized with a temporary certificate. The server runs in a separate goroutine and listens on localhost. Call Close() to stop the server.

func (*Server) Close

func (srv *Server) Close() error

Close stops the server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL