Documentation
¶
Overview ¶
Package graphtest is an in-process Microsoft Graph for tests of Graph sync (docs/design/pim.md, Microsoft Graph), as davtest is for DAV: the account's calendars and contact folders in memory, delta rounds with tokens and pages, series read with their exceptions, contact photos, Graph's writes, and hooks that play another client's changes. It answers as Graph did the probe of an Outlook.com account (plan 0010, Phase 1).
Index ¶
- Constants
- type Server
- func (s *Server) AddCalendar(id, name string, canEdit bool)
- func (s *Server) Contact(id string) (map[string]any, []byte)
- func (s *Server) DeleteContact(folderID, id string)
- func (s *Server) DeleteEvent(calendarID, id string)
- func (s *Server) Event(id string) map[string]any
- func (s *Server) Events(calendarID string) []string
- func (s *Server) OnWrite(f func(method, path string))
- func (s *Server) PutContact(folderID, contact string, photo []byte)
- func (s *Server) PutEvent(calendarID, event string)
- func (s *Server) Throttle(n int)
- func (s *Server) WriteCount() int
- func (s *Server) WritesSince(n int) []string
- type Write
Constants ¶
const PageSize = 2
PageSize is how many items a page holds, small so tests page.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
URL string // the base URL, as graph.BaseURL
Token string // the bearer token it accepts
// User is the account's address, the organizer of the events it
// creates; "" names none.
User string
// Requests counts requests by method and path, without the query.
Requests map[string]int
// contains filtered or unexported fields
}
Server is the fake Graph.
func Start ¶
Start runs a server that accepts token, with a default calendar ("cal-1", "Calendar") and the default contact folder.
func (*Server) AddCalendar ¶
AddCalendar adds a calendar.
func (*Server) DeleteContact ¶
DeleteContact deletes a contact.
func (*Server) DeleteEvent ¶
DeleteEvent deletes an event or a series.
func (*Server) OnWrite ¶
OnWrite calls f before each write the server answers, as another client's change or the user's next edit would come; nil stops it. f runs without the server's lock.
func (*Server) PutContact ¶
PutContact stores a contact in a folder ("contacts" is the default), with photo when it is not nil.
func (*Server) PutEvent ¶
PutEvent stores an event (a single event, or a master with "exceptionOccurrences") in a calendar, as another client would. The event's "id" names it; its change key and ETag are set here.
func (*Server) WriteCount ¶
WriteCount is how many writes the server took.
func (*Server) WritesSince ¶
WritesSince returns the writes after the first n.