mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 17:05:18 +00:00
a23d208b1d
#10739 Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com> Co-authored-by: gillespi314 <73313222+gillespi314@users.noreply.github.com>
39 lines
833 B
Go
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)
|
|
}
|
|
}
|