Documentation
¶
Overview ¶
Package apptest is an in-memory NeuralTrust console for tests. It implements the contract ntctl relies on: OAuth discovery, authorization code + PKCE with a loopback redirect, rotating refresh tokens and revocation, and the CLI API under /api/cli/v1. Every secret it issues (codes, access, refresh, config-sync and enrolment tokens) contains "CANARY", so tests can check none leaks.
Index ¶
- type Issued
- type Server
- func (s *Server) AddInstance(product api.Product, org string, in api.Instance)
- func (s *Server) Browser(authURL string) error
- func (s *Server) ExpireAccessTokens()
- func (s *Server) Finalized(id string) string
- func (s *Server) Instances(product api.Product, org string) []api.Instance
- func (s *Server) Issued() []Issued
- func (s *Server) Sessions() int
- func (s *Server) Update(f func(*Server))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Issued ¶
type Issued struct {
Product, Org, ID string
Rotate bool
Config api.InstallConfig
}
Issued is one install config the console handed out.
type Server ¶
type Server struct {
*httptest.Server
// Email is the signed-in user; Orgs are the organizations they belong to;
// Chosen is the one picked on the consent page.
Email string
Orgs []api.Org
Chosen string
// Deny makes the user refuse consent.
Deny bool
// AccessTTL is how long access tokens live.
AccessTTL time.Duration
// ReadOnly makes every write answer 403, as for a member without ADMIN.
ReadOnly bool
// ControlPlane is the DNS suffix of the control plane the issued tokens
// are valid at; New sets the EU region's.
ControlPlane string
// contains filtered or unexported fields
}
Server is the fake console.
func (*Server) AddInstance ¶
AddInstance adds an existing private instance.
func (*Server) Browser ¶
Browser stands in for the user's browser: it opens the authorization URL and follows the console's redirect back to ntctl.
func (*Server) ExpireAccessTokens ¶
func (s *Server) ExpireAccessTokens()
ExpireAccessTokens makes every access token issued so far stale, as if an hour had passed.