Documentation
¶
Overview ¶
Package hubtest is a fake lockhub for the tests of locks: it speaks the lock API v1 (signed requests, tickets, decisions with a cursor) on an httptest server, and lets a test decide tickets.
Index ¶
- type Hub
- func (h *Hub) Close()
- func (h *Hub) Consumed(id string) bool
- func (h *Hub) Decide(id string, out ticket.Outcome, reason string)
- func (h *Hub) DecideWith(id string, out ticket.Outcome, reason string, key ed25519.PrivateKey, ...)
- func (h *Hub) Pushed() int
- func (h *Hub) SetLockKey(pub ed25519.PublicKey)
- func (h *Hub) SetPushStatus(code int)
- func (h *Hub) Sinces() []string
- func (h *Hub) Ticket(id string) []byte
- func (h *Hub) Tickets() []string
- func (h *Hub) URL() string
- func (h *Hub) Withdrawn(id string) (string, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// Pub and Priv are the hub's key; a lock pins Pub.
Pub ed25519.PublicKey
Priv ed25519.PrivateKey
// contains filtered or unexported fields
}
Hub is a fake lockhub serving one lock instance.
func (*Hub) DecideWith ¶
func (h *Hub) DecideWith(id string, out ticket.Outcome, reason string, key ed25519.PrivateKey, mod func(*ticket.Decision))
DecideWith is Decide signed with key (nil: the hub's), mod applied to the decision before signing (nil: none).
func (*Hub) SetLockKey ¶
SetLockKey changes the lock key the hub pinned for the instance.
func (*Hub) SetPushStatus ¶
SetPushStatus makes every POST /v1/tickets answer code (0: normal).
Click to show internal directories.
Click to hide internal directories.