requireDocumentReadEvents validates that there read events for each doc version specified. There should be only audit events for a given docid and it should be revid specified.
(rt *RestTester, output []byte, docID string, docVersions []string)
| 1518 | |
| 1519 | // requireDocumentReadEvents validates that there read events for each doc version specified. There should be only audit events for a given docid and it should be revid specified. |
| 1520 | func requireDocumentReadEvents(rt *RestTester, output []byte, docID string, docVersions []string) { |
| 1521 | events := jsonLines(rt.TB(), output) |
| 1522 | var docVersionsFound []string |
| 1523 | for _, event := range events { |
| 1524 | // skip events that are the target eventID |
| 1525 | if base.AuditID(event[base.AuditFieldID].(float64)) != base.AuditIDDocumentRead { |
| 1526 | continue |
| 1527 | } |
| 1528 | require.Equal(rt.TB(), docID, event[base.AuditFieldDocID]) |
| 1529 | docVersionsFound = append(docVersionsFound, event[base.AuditFieldDocVersion].(string)) |
| 1530 | } |
| 1531 | require.Len(rt.TB(), docVersions, len(docVersionsFound), "expected exactly %d document read events, got %d", len(docVersions), len(docVersionsFound)) |
| 1532 | require.Equal(rt.TB(), docVersions, docVersionsFound) |
| 1533 | } |
| 1534 | |
| 1535 | // requireAttachmentEvents validates that an attachment CRUD event occurred in the right number only on the correct document. |
| 1536 | func requireAttachmentEvents(rt *RestTester, eventID base.AuditID, output []byte, docID, docVersionStr string, attachmentName string, count int) { |