1package http
2
3import (
4 "encoding/xml"
5 "testing"
6)
7
8func TestAutodiscover(t *testing.T) {
9 // Request by Thunderbird.
10 const body = `<?xml version="1.0" encoding="utf-8"?>
11 <Autodiscover xmlns="http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006">
12 <Request>
13 <EMailAddress>test@example.org</EMailAddress>
14 <AcceptableResponseSchema>http://schemas.microsoft.com/exchange/autodiscover/outlook/responseschema/2006a</AcceptableResponseSchema>
15 </Request>
16 </Autodiscover>
17`
18 var req autodiscoverRequest
19 if err := xml.Unmarshal([]byte(body), &req); err != nil {
20 t.Fatalf("unmarshal autodiscover request: %v", err)
21 }
22
23 if req.Request.EmailAddress != "test@example.org" {
24 t.Fatalf("emailaddress: got %q, expected %q", req.Request.EmailAddress, "test@example.org")
25 }
26}
27