Documentation
¶
Overview ¶
Package mockapi provides mocks of the HTTP API for use in integration tests.
Index ¶
- Variables
- func NewAuthServer(t *testing.T) *httptest.Server
- func NumericID() string
- func ProjectID() string
- type Activity
- type App
- type Backup
- type CanCreateRequiredAction
- type CanCreateResponse
- type Commands
- type Deployment
- type EnvLevelVariable
- type Environment
- type HALLink
- type HalLinks
- type Handler
- func (s *Handler) SetCanCreate(orgID string, r *CanCreateResponse)
- func (s *Handler) SetEnvLevelVariables(projectID, environmentID string, vars []*EnvLevelVariable)
- func (s *Handler) SetEnvironments(envs []*Environment)
- func (s *Handler) SetMyUser(u *User)
- func (s *Handler) SetOrgs(orgs []*Org)
- func (s *Handler) SetProjectActivities(projectID string, activities []*Activity)
- func (s *Handler) SetProjectBackups(projectID string, backups []*Backup)
- func (s *Handler) SetProjectVariables(projectID string, vars []*Variable)
- func (s *Handler) SetProjects(pros []*Project)
- func (s *Handler) SetUserGrants(grants []*UserGrant)
- type Mount
- type Org
- type OrgRef
- type Project
- type ProjectRef
- type ProjectRepository
- type ProjectSubscriptionInfo
- type ProjectUserGrant
- type Subscription
- type User
- type UserGrant
- type UserRef
- type Variable
- type Worker
- type WorkerInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ValidAPITokens = []string{"api-token-1"}
Functions ¶
func NewAuthServer ¶
NewAuthServer creates a new mock authentication server. The caller must call Close() on the server when finished.
Types ¶
type Activity ¶
type Activity struct { ID string `json:"id"` Type string `json:"type"` State string `json:"state"` Result string `json:"result"` CompletionPercent int `json:"completion_percent"` CompletedAt time.Time `json:"completed_at"` StartedAt time.Time `json:"started_at"` Project string `json:"project"` Environments []string `json:"environments"` Description string `json:"description"` Text string `json:"text"` Payload any `json:"payload"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type Backup ¶
type Backup struct { ID string `json:"id"` EnvironmentID string `json:"environment"` Status string `json:"status"` Safe bool `json:"safe"` Restorable bool `json:"restorable"` Automated bool `json:"automated"` CommitID string `json:"commit_id"` ExpiresAt time.Time `json:"expires_at"` Links HalLinks `json:"_links"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type CanCreateRequiredAction ¶
type CanCreateResponse ¶
type CanCreateResponse struct { CanCreate bool `json:"can_create"` Message string `json:"message"` RequiredAction *CanCreateRequiredAction `json:"required_action"` }
type Deployment ¶
type EnvLevelVariable ¶
type Environment ¶
type Environment struct { ID string `json:"id"` Name string `json:"name"` MachineName string `json:"machine_name"` Title string `json:"title"` Type string `json:"type"` Status string `json:"status"` Parent any `json:"parent"` Project string `json:"project"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Links HalLinks `json:"_links"` // contains filtered or unexported fields }
func (*Environment) SetCurrentDeployment ¶
func (e *Environment) SetCurrentDeployment(d *Deployment)
func (*Environment) SetSetting ¶
func (e *Environment) SetSetting(key string, val any)
type HalLinks ¶
func MakeHALLinks ¶
MakeHALLinks helps make a list of HAL links out of arguments in the format name=path.
type Handler ¶
type Handler struct { *chi.Mux // contains filtered or unexported fields }
func NewHandler ¶
func (*Handler) SetCanCreate ¶
func (s *Handler) SetCanCreate(orgID string, r *CanCreateResponse)
func (*Handler) SetEnvLevelVariables ¶
func (s *Handler) SetEnvLevelVariables(projectID, environmentID string, vars []*EnvLevelVariable)
func (*Handler) SetEnvironments ¶
func (s *Handler) SetEnvironments(envs []*Environment)
func (*Handler) SetProjectActivities ¶
func (*Handler) SetProjectBackups ¶
func (*Handler) SetProjectVariables ¶
func (*Handler) SetProjects ¶
func (s *Handler) SetProjects(pros []*Project)
func (*Handler) SetUserGrants ¶
func (s *Handler) SetUserGrants(grants []*UserGrant)
type Org ¶
type Project ¶
type Project struct { ID string `json:"id"` Title string `json:"title"` Region string `json:"region"` Organization string `json:"organization"` Vendor string `json:"vendor"` Repository ProjectRepository `json:"repository"` DefaultBranch string `json:"default_branch"` Links HalLinks `json:"_links"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Subscription ProjectSubscriptionInfo `json:"subscription,omitempty"` SubscriptionID string `json:"-"` }
func (*Project) AsRef ¶
func (p *Project) AsRef() *ProjectRef
type ProjectRef ¶
type ProjectRef struct { ID string `json:"id"` Region string `json:"region"` Title string `json:"title"` Status string `json:"status"` OrganizationID string `json:"organization_id"` SubscriptionID string `json:"subscription_id"` Vendor string `json:"vendor"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type ProjectRepository ¶
type ProjectRepository struct {
URL string `json:"url"`
}
type ProjectSubscriptionInfo ¶
type ProjectSubscriptionInfo struct { LicenseURI string `json:"license_uri,omitempty"` Plan string `json:"plan,omitempty"` Environments int `json:"environments,omitempty"` Storage int `json:"storage,omitempty"` IncludedUsers int `json:"included_users,omitempty"` UserLicenses int `json:"user_licenses,omitempty"` ManagementURI string `json:"subscription_management_uri,omitempty"` Restricted bool `json:"restricted,omitempty"` Suspended bool `json:"suspended,omitempty"` }
type ProjectUserGrant ¶
type Subscription ¶
type User ¶
type User struct { ID string `json:"id"` Deactivated bool `json:"deactivated"` Namespace string `json:"namespace"` Username string `json:"username"` FirstName string `json:"first_name"` LastName string `json:"last_name"` Email string `json:"email"` EmailVerified bool `json:"email_verified"` Picture string `json:"picture"` Country string `json:"country"` PhoneNumberVerified bool `json:"phone_number_verified"` MFAEnabled bool `json:"mfa_enabled"` SSOEnabled bool `json:"sso_enabled"` ConsentMethod string `json:"consent_method"` ConsentedAt time.Time `json:"consented_at"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type UserGrant ¶
type UserGrant struct { ResourceID string `json:"resource_id"` ResourceType string `json:"resource_type"` OrganizationID string `json:"organization_id"` UserID string `json:"user_id"` Permissions []string `json:"permissions"` GrantedAt time.Time `json:"granted_at"` UpdatedAt time.Time `json:"updated_at"` }
type Variable ¶
type Variable struct { Name string `json:"name"` Value string `json:"value,omitempty"` IsSensitive bool `json:"is_sensitive"` VisibleBuild bool `json:"visible_build"` VisibleRuntime bool `json:"visible_runtime"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Links HalLinks `json:"_links"` }
type Worker ¶
type Worker struct { App Worker WorkerInfo `json:"worker"` }
type WorkerInfo ¶
type WorkerInfo struct {
Commands Commands `json:"commands"`
}
Click to show internal directories.
Click to hide internal directories.