@@ -1237,9 +1237,6 @@ func TestApplyMacosSetup(t *testing.T) {
|
||||
invalidWebURLMacosSetup := writeTmpJSON(t, map[string]any{
|
||||
"configuration_web_url": "https://example.com",
|
||||
})
|
||||
invalidAwaitDeviceMacosSetup := writeTmpJSON(t, map[string]any{
|
||||
"await_device_configured": true,
|
||||
})
|
||||
invalidURLMacosSetup := writeTmpJSON(t, map[string]any{
|
||||
"url": "https://example.com",
|
||||
})
|
||||
@@ -1553,12 +1550,6 @@ spec:
|
||||
require.ErrorContains(t, err, "The automatic enrollment profile can’t include configuration_web_url.")
|
||||
assert.False(t, ds.SetOrUpdateMDMAppleSetupAssistantFuncInvoked)
|
||||
|
||||
// apply appconfig with invalid key #2
|
||||
name = writeTmpYml(t, fmt.Sprintf(appConfigSpec, "", invalidAwaitDeviceMacosSetup))
|
||||
_, err = runAppNoChecks([]string{"apply", "-f", name})
|
||||
require.ErrorContains(t, err, "The automatic enrollment profile can’t include await_device_configured.")
|
||||
assert.False(t, ds.SetOrUpdateMDMAppleSetupAssistantFuncInvoked)
|
||||
|
||||
// apply appconfig with invalid key #3
|
||||
name = writeTmpYml(t, fmt.Sprintf(appConfigSpec, "", invalidURLMacosSetup))
|
||||
_, err = runAppNoChecks([]string{"apply", "-f", name})
|
||||
@@ -1572,12 +1563,6 @@ spec:
|
||||
require.ErrorContains(t, err, "The automatic enrollment profile can’t include configuration_web_url.")
|
||||
assert.False(t, ds.SetOrUpdateMDMAppleSetupAssistantFuncInvoked)
|
||||
|
||||
// apply teams with invalid key #2
|
||||
name = writeTmpYml(t, fmt.Sprintf(team1And2Spec, "", invalidAwaitDeviceMacosSetup, "", invalidAwaitDeviceMacosSetup))
|
||||
_, err = runAppNoChecks([]string{"apply", "-f", name})
|
||||
require.ErrorContains(t, err, "The automatic enrollment profile can’t include await_device_configured.")
|
||||
assert.False(t, ds.SetOrUpdateMDMAppleSetupAssistantFuncInvoked)
|
||||
|
||||
// apply teams with invalid key #3
|
||||
name = writeTmpYml(t, fmt.Sprintf(team1And2Spec, "", invalidURLMacosSetup, "", invalidURLMacosSetup))
|
||||
_, err = runAppNoChecks([]string{"apply", "-f", name})
|
||||
|
||||
@@ -460,9 +460,8 @@ func (svc *Service) SetOrUpdateMDMAppleSetupAssistant(ctx context.Context, asst
|
||||
}
|
||||
|
||||
deniedFields := map[string]string{
|
||||
"configuration_web_url": `Couldn’t edit macos_setup_assistant. The automatic enrollment profile can’t include configuration_web_url. To require end user authentication, use the macos_setup.end_user_authentication option.`,
|
||||
"await_device_configured": `Couldn’t edit macos_setup_assistant. The automatic enrollment profile can’t include await_device_configured.`,
|
||||
"url": `Couldn’t edit macos_setup_assistant. The automatic enrollment profile can’t include url.`,
|
||||
"configuration_web_url": `Couldn’t edit macos_setup_assistant. The automatic enrollment profile can’t include configuration_web_url. To require end user authentication, use the macos_setup.end_user_authentication option.`,
|
||||
"url": `Couldn’t edit macos_setup_assistant. The automatic enrollment profile can’t include url.`,
|
||||
}
|
||||
for k, msg := range deniedFields {
|
||||
if _, ok := m[k]; ok {
|
||||
|
||||
@@ -3687,18 +3687,6 @@ func (s *integrationMDMTestSuite) TestMacosSetupAssistant() {
|
||||
s.lastActivityMatches(fleet.ActivityTypeChangedMacosSetupAssistant{}.ActivityName(),
|
||||
fmt.Sprintf(`{"name": "team2", "team_id": %d, "team_name": %q}`, tm.ID, tm.Name), latestChangedActID)
|
||||
|
||||
// try to set the await_device_configured
|
||||
tmProf = `{"await_device_configured": true}`
|
||||
res = s.Do("POST", "/api/latest/fleet/mdm/apple/enrollment_profile", createMDMAppleSetupAssistantRequest{
|
||||
TeamID: &tm.ID,
|
||||
Name: "team4",
|
||||
EnrollmentProfile: json.RawMessage(tmProf),
|
||||
}, http.StatusUnprocessableEntity)
|
||||
errMsg = extractServerErrorText(res.Body)
|
||||
require.Contains(t, errMsg, `The automatic enrollment profile can’t include await_device_configured.`)
|
||||
s.lastActivityMatches(fleet.ActivityTypeChangedMacosSetupAssistant{}.ActivityName(),
|
||||
fmt.Sprintf(`{"name": "team2", "team_id": %d, "team_name": %q}`, tm.ID, tm.Name), latestChangedActID)
|
||||
|
||||
// try to set the url
|
||||
tmProf = `{"url": "https://example.com"}`
|
||||
res = s.Do("POST", "/api/latest/fleet/mdm/apple/enrollment_profile", createMDMAppleSetupAssistantRequest{
|
||||
|
||||
Reference in New Issue
Block a user