mirror of
https://github.com/mjl-/mox.git
synced 2024-12-25 16:03:48 +03:00
26 lines
826 B
Go
26 lines
826 B
Go
package http
|
|
|
|
import (
|
|
"encoding/xml"
|
|
"testing"
|
|
)
|
|
|
|
func TestAutodiscover(t *testing.T) {
|
|
// Request by Thunderbird.
|
|
const body = `<?xml version="1.0" encoding="utf-8"?>
|
|
<Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
|
|
<Request>
|
|
<EMailAddress>test@example.org</EMailAddress>
|
|
<AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
|
|
</Request>
|
|
</Autodiscover>
|
|
`
|
|
var req autodiscoverRequest
|
|
if err := xml.Unmarshal([]byte(body), &req); err != nil {
|
|
t.Fatalf("unmarshal autodiscover request: %v", err)
|
|
}
|
|
|
|
if req.Request.EmailAddress != "test@example.org" {
|
|
t.Fatalf("emailaddress: got %q, expected %q", req.Request.EmailAddress, "test@example.org")
|
|
}
|
|
}
|