MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / newGraphHTTP

Function newGraphHTTP

internal/server/commitment_graph_entry_test.go:22–40  ·  view source on GitHub ↗
(t *testing.T, roles ...models.CommitmentRolesInput)

Source from the content-addressed store, hash-verified

20}
21
22func newGraphHTTP(t *testing.T, roles ...models.CommitmentRolesInput) *graphHTTP {
23 f := &graphHTTP{schedHTTP: newSchedHTTP(t), access: models.CommitmentAccess{Readable: map[string]bool{}, Editable: map[string]bool{}}}
24 for i, r := range roles {
25 it := f.item
26 if i > 0 {
27 it = mustItem(t, f.srv, f.ws.ID, f.coll.ID, "Graph item")
28 }
29 start := time.Now().UTC().Truncate(time.Second).Add(time.Duration(10+i) * 24 * time.Hour)
30 sc, err := f.srv.store.CreateCommitmentSchedule(f.ws.ID, it.ID, models.ScheduleCreate{Dtstart: start.Format("2006-01-02T15:04:05"), Tz: "UTC"}, r)
31 if err != nil {
32 t.Fatal(err)
33 }
34 f.items = append(f.items, it)
35 f.dates = append(f.dates, *sc.NextAt)
36 f.access.Readable[it.ID] = true
37 f.access.Editable[it.ID] = true
38 }
39 return f
40}
41func graphHard() models.CommitmentRolesInput {
42 d, s, b := 2, 0, "stays_owed"
43 return models.CommitmentRolesInput{DeadlineDays: &d, DeadlineSecs: &s, DeadlineBehavior: &b}

Calls 7

newSchedHTTPFunction · 0.85
mustItemFunction · 0.85
appendFunction · 0.85
FatalMethod · 0.80
AddMethod · 0.65
NowMethod · 0.65

Tested by

no test coverage detected