- Added configuration options for Stalwart hosted mail in .env.example. - Updated Docker Compose to include Stalwart service with health checks. - Introduced new API endpoints for managing mail domains and migration projects. - Enhanced Authentik blueprints for user enrollment and post-migration security. - Updated OAuth handling for Google and Microsoft migration processes. - Improved error handling and response structures in the mail API. - Added integration tests for email claiming and migration workflows.
50 lines
1.2 KiB
Go
50 lines
1.2 KiB
Go
package migration
|
|
|
|
import "testing"
|
|
|
|
func TestGraphWellKnownFolder(t *testing.T) {
|
|
remote, ftype := graphWellKnownFolder("inbox", "Inbox")
|
|
if remote != "INBOX" || ftype != "inbox" {
|
|
t.Fatalf("got %q / %q", remote, ftype)
|
|
}
|
|
|
|
remote, ftype = graphWellKnownFolder("", "Projects")
|
|
if remote != "PROJECTS" || ftype != "custom" {
|
|
t.Fatalf("custom folder: got %q / %q", remote, ftype)
|
|
}
|
|
}
|
|
|
|
func TestGraphFlags(t *testing.T) {
|
|
flags := graphFlags(true, "notFlagged")
|
|
if len(flags) != 1 || flags[0] != "\\Seen" {
|
|
t.Fatalf("read flags: %v", flags)
|
|
}
|
|
flags = graphFlags(false, "flagged")
|
|
if len(flags) != 1 || flags[0] != "\\Flagged" {
|
|
t.Fatalf("flagged: %v", flags)
|
|
}
|
|
}
|
|
|
|
func TestGraphRecipientsJSON(t *testing.T) {
|
|
raw := graphRecipientsJSON([]graphRecipient{
|
|
{EmailAddress: graphEmailAddress{Name: "Bob", Address: "bob@example.com"}},
|
|
})
|
|
if string(raw) != `[{"name":"Bob","email":"bob@example.com"}]` {
|
|
t.Fatalf("unexpected json: %s", raw)
|
|
}
|
|
}
|
|
|
|
func TestParseGraphTime(t *testing.T) {
|
|
tm := parseGraphTime("2024-05-01T12:34:56Z")
|
|
if tm.IsZero() {
|
|
t.Fatal("expected parsed time")
|
|
}
|
|
}
|
|
|
|
func TestRemoteMessageUIDMatchesGmailUID(t *testing.T) {
|
|
id := "abc123"
|
|
if remoteMessageUID(id) != gmailUID(id) {
|
|
t.Fatal("uid helpers diverged")
|
|
}
|
|
}
|