mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-02 20:29:43 +00:00
Correct Apprise confidentiality queue and API fixtures
Handle nullable retry-row diagnostics while checking the actual attempt audit and DLQ error; verify omitted stored API keys through the established redacted response type and preserve authorised endpoint/target round-trips. Retain the original diagnostic repair and its adverse proof. Change-source: pulse-maintainer
This commit is contained in:
parent
1ce98f2693
commit
2e331d594d
2 changed files with 14 additions and 4 deletions
|
|
@ -51,10 +51,13 @@ func TestAppriseConfigurationLogsWithholdSecrets(t *testing.T) {
|
|||
if !strings.Contains(captured.String(), "hasConfigKey") || !strings.Contains(captured.String(), "targetCount") {
|
||||
t.Fatal("structured configuration diagnostics were lost")
|
||||
}
|
||||
var response map[string]any
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &response); err != nil || response["apiKey"] != "" || response["hasApiKey"] != true {
|
||||
var response appriseConfigResponse
|
||||
if err := json.Unmarshal(w.Body.Bytes(), &response); err != nil || response.APIKey != "" || !response.HasAPIKey {
|
||||
t.Fatal("saved API-key response contract changed")
|
||||
}
|
||||
if response.ServerURL != cfg.ServerURL || response.ConfigKey != cfg.ConfigKey || len(response.Targets) != 1 || response.Targets[0] != cfg.Targets[0] {
|
||||
t.Fatal("authorised configuration round-trip changed")
|
||||
}
|
||||
manager.AssertExpectations(t)
|
||||
persistence.AssertExpectations(t)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"crypto/x509"
|
||||
"database/sql"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
|
|
@ -323,7 +324,10 @@ func TestAppriseQueueConfidentiality(t *testing.T) {
|
|||
time.Sleep(time.Millisecond)
|
||||
}
|
||||
q.SetProcessor(nil)
|
||||
var gotStatus, lastError, rawConfig string
|
||||
var gotStatus, rawConfig string
|
||||
// Retry scheduling leaves last_error nullable; the attempt audit
|
||||
// holds the failure text. DLQ also retains it on the queue row.
|
||||
var lastError sql.NullString
|
||||
var attempts int
|
||||
if err := q.db.QueryRow("SELECT status, attempts, last_error, config FROM notification_queue WHERE id = ?", notif.ID).Scan(&gotStatus, &attempts, &lastError, &rawConfig); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -335,7 +339,10 @@ func TestAppriseQueueConfidentiality(t *testing.T) {
|
|||
if gotStatus != string(wantStatus) || attempts != 1 || rawConfig != string(config) {
|
||||
t.Error("queue lifecycle, attempt budget or admitted credentials changed")
|
||||
}
|
||||
assertAppriseConfidential(t, lastError)
|
||||
if status == http.StatusUnauthorized && (!lastError.Valid || !strings.Contains(lastError.String, "HTTP 401")) {
|
||||
t.Error("DLQ error observation was lost")
|
||||
}
|
||||
assertAppriseConfidential(t, lastError.String)
|
||||
var auditError, class string
|
||||
if err := q.db.QueryRow("SELECT error_message, failure_class FROM notification_audit WHERE notification_id = ?", notif.ID).Scan(&auditError, &class); err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue