(t *testing.T, roles ...models.CommitmentRolesInput)
| 20 | } |
| 21 | |
| 22 | func 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 | } |
| 41 | func graphHard() models.CommitmentRolesInput { |
| 42 | d, s, b := 2, 0, "stays_owed" |
| 43 | return models.CommitmentRolesInput{DeadlineDays: &d, DeadlineSecs: &s, DeadlineBehavior: &b} |
no test coverage detected