Documentation ¶
Overview ¶
Package fakedms implements a library for setting policies via a locally-hosted Device Management Server.
Index ¶
- Constants
- type FakeDMS
- func (fdms *FakeDMS) FakeDMS() *FakeDMS
- func (fdms *FakeDMS) Ping(ctx context.Context) error
- func (fdms *FakeDMS) SetPersistentPolicies(persistentPolicies []policy.Policy)
- func (fdms *FakeDMS) SetPersistentPolicyUser(persistentPolicyUser *string)
- func (fdms *FakeDMS) SetPersistentPublicAccountPolicies(persistentPublicAccountPolicies map[string][]policy.Policy)
- func (fdms *FakeDMS) Stop(ctx context.Context)
- func (fdms *FakeDMS) WritePolicyBlob(pb *policy.Blob) error
- func (fdms *FakeDMS) WritePolicyBlobRaw(pJSON []byte) error
- type HasFakeDMS
Constants ¶
const EnrollmentFakeDMSDir = "/var/enrolling-fdms"
EnrollmentFakeDMSDir is the directory where FakeDMS stores state during enrollment. Used to share state between the enrolled fixture and the fakeDMSEnrolled fixtures. TODO(crbug.com/1187473): Remove
const LogFile = "fakedms.log"
LogFile is the name of the log file for FakeDMS.
const PolicyFile = "policy.json"
PolicyFile is the name of the config file for FakeDMS.
const StateFile = "state.json"
StateFile is the name of the state file for FakeDMS.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeDMS ¶
type FakeDMS struct { URL string // fakedms url; needs to be passed to Chrome; set in start() // contains filtered or unexported fields }
A FakeDMS struct contains information about a running policy_testserver instance.
func New ¶
New creates and starts a fake Domain Management Server to serve policies. outDir is used to write logs and policies, and should either be in a temporary location (and deleted by caller) or in the test's results directory.
func (*FakeDMS) Ping ¶
Ping pings the running FakeDMS server and returns an error if all is not well.
func (*FakeDMS) SetPersistentPolicies ¶
SetPersistentPolicies will ensure that the provided policies are always set.
func (*FakeDMS) SetPersistentPolicyUser ¶
SetPersistentPolicyUser will ensure that the provided PolicyUser is always set.
func (*FakeDMS) SetPersistentPublicAccountPolicies ¶
func (fdms *FakeDMS) SetPersistentPublicAccountPolicies(persistentPublicAccountPolicies map[string][]policy.Policy)
SetPersistentPublicAccountPolicies will ensure that the provided public account policies are always set.
func (*FakeDMS) WritePolicyBlob ¶
WritePolicyBlob will write the given PolicyBlob to be read by the FakeDMS.
func (*FakeDMS) WritePolicyBlobRaw ¶
WritePolicyBlobRaw writes the given PolicyBlob JSON string to be read by the FakeDMS. To apply persistent settings, pJSON is unmarshalled and then marshalled as PolicyBlob.
type HasFakeDMS ¶
type HasFakeDMS interface {
FakeDMS() *FakeDMS
}
HasFakeDMS is an interface for fixture values that contain a FakeDMS instance. It allows retrieval of the underlying FakeDMS object.