mirror of
https://github.com/empayre/fleet.git
synced 2024-11-06 00:45:19 +00:00
fix tests
This commit is contained in:
parent
4e11b3574c
commit
e39d5d9341
@ -3342,7 +3342,7 @@ func (svc *MDMAppleDDMService) handleDeclarationsResponse(ctx context.Context, e
|
||||
case "configuration":
|
||||
return svc.handleConfigurationDeclaration(ctx, parts, hostUUID)
|
||||
default:
|
||||
return nil, nano_service.NewHTTPStatusError(http.StatusBadRequest, ctxerr.Errorf(ctx, "declaration type not supported: %s", parts[1]))
|
||||
return nil, nano_service.NewHTTPStatusError(http.StatusNotFound, ctxerr.Errorf(ctx, "declaration type not supported: %s", parts[1]))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -450,16 +450,14 @@ INSERT INTO host_mdm_apple_declarations (
|
||||
|
||||
// try getting a non-existent declaration, should fail 404
|
||||
nonExistantDeclarationPath := fmt.Sprintf("declaration/%s/%s", "configuration", "nonexistent")
|
||||
res, err := mdmDevice.DeclarativeManagement(nonExistantDeclarationPath)
|
||||
_, err = mdmDevice.DeclarativeManagement(nonExistantDeclarationPath)
|
||||
require.Error(t, err)
|
||||
require.Equal(t, http.StatusNotFound, res.StatusCode)
|
||||
require.ErrorContains(t, err, "404 Not Found")
|
||||
|
||||
// try getting an unsupported declaration, should fail 404
|
||||
unsupportedDeclarationPath := fmt.Sprintf("declaration/%s/%s", "asset", "nonexistent")
|
||||
res, err = mdmDevice.DeclarativeManagement(unsupportedDeclarationPath)
|
||||
_, err = mdmDevice.DeclarativeManagement(unsupportedDeclarationPath)
|
||||
require.Error(t, err)
|
||||
require.Equal(t, http.StatusNotFound, res.StatusCode)
|
||||
require.ErrorContains(t, err, "404 Not Found")
|
||||
|
||||
// typo should fail as bad request
|
||||
|
Loading…
Reference in New Issue
Block a user