test: require review fix assertions
- test: require review fix assertions - test: cover zone repair and imported dns records - test: wait for dns and tighten assertions - fix(api): drop the record id of a rolled back record creation - test(audit): run every api route through the real handlers in an audit matrix - test(api): run the authorization matrix through the real zone handlers - test: repair duplicate apex soa through ui
This commit is contained in:
1 parent
a884219512
commit
9251c85fd8
14 files changed
+1631
-123
No files matched your search
@@ -658,41 +658,6 @@ func (h *webHarness) withHandlers(handlers map[string]apiHandler) {
|
||||
h.handler = h.s.Handler()
|
||||
}
|
||||
|
||||
func (h *webHarness) withFakeZoneHandlers() {
|
||||
handlers := frameworkAPIHandlers(h.s)
|
||||
maps.Copy(handlers, fakeZoneHandlers())
|
||||
h.withHandlers(handlers)
|
||||
}
|
||||
|
||||
func fakeZoneHandlers() map[string]apiHandler {
|
||||
out := map[string]apiHandler{}
|
||||
for _, op := range zoneOperations {
|
||||
kind := ""
|
||||
for _, o := range auditOperations {
|
||||
if o.Name == op {
|
||||
kind = o.Kind
|
||||
}
|
||||
}
|
||||
if kind == auditKindRead {
|
||||
out[op] = func(ctx context.Context, c *apiContext) (apiResponse, error) {
|
||||
return okJSON(map[string]string{"operation": op, "zone": c.Zone}), nil
|
||||
}
|
||||
continue
|
||||
}
|
||||
out[op] = func(ctx context.Context, c *apiContext) (apiResponse, error) {
|
||||
err := c.Server.store.InTx(ctx, func(tx webTx) error {
|
||||
c.Entry.After = []byte(`{"fake":true}`)
|
||||
return c.writeChangeAuditWith(ctx, tx, http.StatusOK)
|
||||
})
|
||||
if err != nil {
|
||||
return apiResponse{}, err
|
||||
}
|
||||
return okJSON(map[string]string{"operation": op}), nil
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
func (h *webHarness) user(username, role string) userRow {
|
||||
u := h.store.addUser(username, role)
|
||||
h.users[username] = u
|
||||
|
||||
Reference in new issue
Block a user