fleet/server/mdm/apple/util_test.go
Roberto Dip a23d208b1d
gate DEP enrollment behind SSO when configured (#11309)
#10739

Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>
2023-04-27 09:43:20 -03:00

39 lines
833 B
Go

package apple_mdm
import (
"testing"
"github.com/fleetdm/fleet/v4/server/fleet"
"github.com/stretchr/testify/require"
)
func TestMDMAppleEnrollURL(t *testing.T) {
cases := []struct {
appConfig *fleet.AppConfig
expectedURL string
}{
{
appConfig: &fleet.AppConfig{
ServerSettings: fleet.ServerSettings{
ServerURL: "https://foo.example.com",
},
},
expectedURL: "https://foo.example.com/api/mdm/apple/enroll?token=tok",
},
{
appConfig: &fleet.AppConfig{
ServerSettings: fleet.ServerSettings{
ServerURL: "https://foo.example.com/",
},
},
expectedURL: "https://foo.example.com/api/mdm/apple/enroll?token=tok",
},
}
for _, tt := range cases {
enrollURL, err := EnrollURL("tok", tt.appConfig)
require.NoError(t, err)
require.Equal(t, tt.expectedURL, enrollURL)
}
}