ipptest

package
v0.3.21 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 11 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ipptest is a fake CUPS scheduler on loopback for tests: the queues a test sets answer CUPS-Get-Printers, Get-Printer-Attributes and CUPS-Get-Default, CUPS-Create-Local-Printer adds one, and Print-Job records what it is sent. It also stands in for a network printer answering its own attributes. Nothing reaches a real printer or the host's cupsd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Printer  string
	Groups   []ipp.Group
	Document []byte
}

Job is one Print-Job the scheduler took: the queue its URI named, its attribute groups and its document.

type Server

type Server struct {
	// Addr is host:port, for ipp.NewClient.
	Addr string
	// contains filtered or unexported fields
}

Server is the fake scheduler.

func Start

func Start(t *testing.T) *Server

Start runs the scheduler on loopback until the test ends.

func StartDevice

func StartDevice(t *testing.T, secure bool, attrs ...ipp.Attr) *Server

StartDevice runs a network printer on IPv4 loopback, over TLS with a self-signed certificate (ipps) or plain HTTP (ipp), answering its attributes at any URI.

func StartDeviceAt

func StartDeviceAt(t *testing.T, addr string, secure bool, attrs ...ipp.Attr) *Server

StartDeviceAt is StartDevice listening at addr ("[::1]:0" for IPv6 loopback).

func (*Server) Client

func (s *Server) Client() *ipp.Client

Client is a client of the scheduler.

func (*Server) Created

func (s *Server) Created(name string) string

Created is the device URI of each queue CUPS-Create-Local-Printer made, by name.

func (*Server) Hold

func (s *Server) Hold()

Hold makes every request wait until Release.

func (*Server) Jobs

func (s *Server) Jobs() []Job

Jobs are the Print-Jobs taken.

func (*Server) Ops

func (s *Server) Ops() []uint16

Ops are the operations asked for, in order, and Replies how many answers were sent.

func (*Server) Release

func (s *Server) Release()

Release lets the held requests and every later one through.

func (*Server) Replies

func (s *Server) Replies() int

Replies is how many answers were sent.

func (*Server) SetDefault

func (s *Server) SetDefault(name string)

SetDefault makes name the scheduler's default destination.

func (*Server) SetPrinter

func (s *Server) SetPrinter(name string, attrs ...ipp.Attr)

SetPrinter adds the queue name, or replaces its attributes, with printer-name set and the rest as given.

Jump to

Keyboard shortcuts

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