imaptest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package imaptest runs go-imap's in-memory IMAP server over TLS for integration tests.

Index

Constants

View Source
const (
	Username = "me@example.test"
	Password = "app-pass-wxyz-1234" // #nosec G101 -- exists only on the in-memory test server
)

The one account on the test server.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Host string
	Port int
	TLS  *tls.Config         // client config that trusts the server's certificate
	User *imapmemserver.User // create folders and inspect state directly
	// contains filtered or unexported fields
}

Server is a running in-memory IMAP server with one user and an INBOX.

func Start

func Start(t testing.TB, caps imap.CapSet) *Server

Start serves until the test ends. caps is what the server advertises; nil means plain IMAP4rev1 (which still includes IDLE, but neither MOVE nor UIDPLUS).

func (*Server) Append

func (s *Server) Append(t testing.TB, folder, eml string, flags ...imap.Flag) uint32

Append delivers a message straight into a folder and returns its UID.

func (*Server) KillConnections

func (s *Server) KillConnections()

KillConnections cuts every open connection, as a network drop would.

func (*Server) RefuseCreate

func (s *Server) RefuseCreate(refuse bool)

RefuseCreate makes the server answer CREATE with NO, as a server that does not let a client make folders would, until it is called with false.

Jump to

Keyboard shortcuts

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