- Introduced new functionality for managing email attachments and drafts in the mail API. - Added handlers for listing, uploading, and downloading message attachments in `internal/api/mail/handlers_attachments.go`. - Implemented draft management endpoints for creating, updating, and deleting drafts in `internal/api/mail/handlers_drafts.go`. - Created new service methods for handling draft and attachment operations in `internal/api/mail/drafts.go` and `internal/api/mail/storage.go`. - Added validation and error handling for draft and attachment operations. - Included unit tests for draft and folder functionalities in `internal/api/mail/drafts_test.go` and `internal/api/mail/folders_test.go`. - Updated API routes to support new draft and attachment features, enhancing overall mail management capabilities.
22 lines
483 B
Go
22 lines
483 B
Go
package users
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ultisuite/ulti-backend/internal/auth"
|
|
)
|
|
|
|
func TestProvisionEmail_fromClaim(t *testing.T) {
|
|
got := ProvisionEmail(&auth.Claims{Sub: "sub-1", Email: "a@b.com"})
|
|
if got != "a@b.com" {
|
|
t.Fatalf("ProvisionEmail() = %q, want a@b.com", got)
|
|
}
|
|
}
|
|
|
|
func TestProvisionEmail_fallback(t *testing.T) {
|
|
got := ProvisionEmail(&auth.Claims{Sub: "sub-1"})
|
|
if got != "sub-1@unknown.ultimail.local" {
|
|
t.Fatalf("ProvisionEmail() = %q", got)
|
|
}
|
|
}
|