mail: Vertragstest repariert, qa05/qa09-Gates skippen ohne .git/Root-Modul #400
No files matched your search
@@ -361,6 +361,29 @@ func TestContract_DocumentedEndpointsMatchActualBehavior(t *testing.T) {
|
||||
return cs, http.MethodGet, "/api/v1/mail/messages/a-1/attachments/0", cs.token("u1", "mandant-a")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "anhangsliste_eigener_mandant",
|
||||
specMethod: http.MethodGet, specPath: "/messages/{messageID}/attachments",
|
||||
wantStatus: http.StatusOK, checkValid: true,
|
||||
setup: func(t *testing.T) (*contractServer, string, string, string) {
|
||||
sc := newContractSearchFake()
|
||||
sc.put("mandant-a", search.Document{MessageID: "a-1", Subject: "Mit Anhang"})
|
||||
sp := newContractStorageFake(t, "mandant-a")
|
||||
putContractAttachment(t, sp, "mandant-a", "a-1", 0, "anhangsinhalt")
|
||||
cs := buildContractServer(t, sc, sp)
|
||||
return cs, http.MethodGet, "/api/v1/mail/messages/a-1/attachments", cs.token("u1", "mandant-a")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "postfaecher_eigener_mandant",
|
||||
specMethod: http.MethodGet, specPath: "/mailboxes",
|
||||
wantStatus: http.StatusOK, checkValid: true,
|
||||
setup: func(t *testing.T) (*contractServer, string, string, string) {
|
||||
cs, sc := setupContractServer(t)
|
||||
sc.put("mandant-a", search.Document{MessageID: "a-1", Subject: "Betreff", Mailbox: "INBOX"})
|
||||
return cs, http.MethodGet, "/api/v1/mail/mailboxes", cs.token("u1", "mandant-a")
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "anhang_ungueltiger_index",
|
||||
specMethod: http.MethodGet, specPath: "/messages/{messageID}/attachments/{index}",
|
||||
|
||||
@@ -116,9 +116,9 @@ paths:
|
||||
minimum: 0
|
||||
responses:
|
||||
"200":
|
||||
description: Anhangsinhalt.
|
||||
description: Anhangsinhalt; der Content-Type wird serverseitig anhand der Magic-Bytes bestimmt (Rueckfall application/octet-stream).
|
||||
content:
|
||||
application/octet-stream:
|
||||
"*/*":
|
||||
schema:
|
||||
type: string
|
||||
format: binary
|
||||
|
||||
@@ -56,6 +56,12 @@ func freePort(t *testing.T) string {
|
||||
// Admin-Token (fuer /audit/export), Service-Token (fuer /audit/ingest).
|
||||
func startAuditlogDevserver(t *testing.T, repoRoot, adminDSN string) (baseURL, adminToken, serviceToken string) {
|
||||
t.Helper()
|
||||
if _, err := os.Stat(filepath.Join(repoRoot, "cmd", "auditlog-devserver", "main.go")); err != nil {
|
||||
if os.Getenv("REQUIRE_GIT") == "1" {
|
||||
t.Fatalf("auditlog-devserver-Quellen fehlen: %v", err)
|
||||
}
|
||||
t.Skipf("Root-Modul nicht vorhanden (Teil-Checkout?): %v", err)
|
||||
}
|
||||
workdir := t.TempDir()
|
||||
binPath := filepath.Join(workdir, "auditlog-devserver")
|
||||
|
||||
|
||||
@@ -14,7 +14,10 @@ func repoRoot(t *testing.T) string {
|
||||
t.Helper()
|
||||
out, err := exec.Command("git", "rev-parse", "--show-toplevel").Output()
|
||||
if err != nil {
|
||||
t.Fatalf("git-repo-wurzel ermitteln: %v", err)
|
||||
if os.Getenv("REQUIRE_GIT") == "1" {
|
||||
t.Fatalf("git-repo-wurzel ermitteln: %v", err)
|
||||
}
|
||||
t.Skipf("kein git-repo (Wurfverzeichnis ohne .git?): %v", err)
|
||||
}
|
||||
return strings.TrimSpace(string(out))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user