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