mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-25 14:35:48 +03:00
ae8de95d89
Merge in DNS/adguard-home from 2234-move-to-internal to master Squashed commit of the following: commit d26a288cabeac86f9483fab307677b1027c78524 Author: Eugene Burkov <e.burkov@adguard.com> Date: Fri Oct 30 12:44:18 2020 +0300 * all: move internal Go packages to internal/ Closes #2234.
33 lines
796 B
Go
33 lines
796 B
Go
package home
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"howett.net/plist"
|
|
)
|
|
|
|
func TestHandleMobileConfigDot(t *testing.T) {
|
|
var err error
|
|
|
|
var r *http.Request
|
|
r, err = http.NewRequest(http.MethodGet, "https://example.com:12345/apple/dot.mobileconfig", nil)
|
|
assert.Nil(t, err)
|
|
|
|
w := httptest.NewRecorder()
|
|
|
|
handleMobileConfigDot(w, r)
|
|
assert.Equal(t, http.StatusOK, w.Code)
|
|
|
|
var mc MobileConfig
|
|
_, err = plist.Unmarshal(w.Body.Bytes(), &mc)
|
|
assert.Nil(t, err)
|
|
|
|
if assert.Equal(t, 1, len(mc.PayloadContent)) {
|
|
assert.Equal(t, "example.com DoT", mc.PayloadContent[0].Name)
|
|
assert.Equal(t, "example.com DoT", mc.PayloadContent[0].PayloadDisplayName)
|
|
assert.Equal(t, "example.com", mc.PayloadContent[0].DNSSettings.ServerName)
|
|
}
|
|
}
|