| 1 | package persist |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/cloudflare/redoctober/config" |
| 7 | ) |
| 8 | |
| 9 | func TestNew(t *testing.T) { |
| 10 | cfg := &config.Delegations{ |
| 11 | Persist: true, |
| 12 | Policy: "policy", |
| 13 | Users: []string{"alice"}, |
| 14 | Mechanism: FileMechanism, |
| 15 | Location: "testdata/store.bin", |
| 16 | } |
| 17 | |
| 18 | store, err := New(cfg) |
| 19 | if err != nil { |
| 20 | t.Fatalf("persist: failed to create a new store: %s", err) |
| 21 | } |
| 22 | |
| 23 | if _, ok := store.(*File); !ok { |
| 24 | t.Fatalf("persist: New should return a *File, but returned a %T", store) |
| 25 | } |
| 26 | } |