mirror of
https://github.com/fleetdm/fleet
synced 2026-05-17 05:58:40 +00:00
Add integration test of batch-setting with self-service
This commit is contained in:
parent
d65f59ed84
commit
e6de0dcebd
2 changed files with 14 additions and 3 deletions
|
|
@ -469,9 +469,10 @@ INSERT INTO software_installers (
|
|||
pre_install_query,
|
||||
post_install_script_content_id,
|
||||
platform,
|
||||
self_service,
|
||||
title_id
|
||||
) VALUES (
|
||||
?, ?, ?, ?, ?, ?, ?, ?, ?,
|
||||
?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
|
||||
(SELECT id FROM software_titles WHERE name = ? AND source = ? AND browser = '')
|
||||
)
|
||||
ON DUPLICATE KEY UPDATE
|
||||
|
|
@ -481,7 +482,8 @@ ON DUPLICATE KEY UPDATE
|
|||
filename = VALUES(filename),
|
||||
version = VALUES(version),
|
||||
pre_install_query = VALUES(pre_install_query),
|
||||
platform = VALUES(platform)
|
||||
platform = VALUES(platform),
|
||||
self_service = VALUES(self_service)
|
||||
`
|
||||
|
||||
// use a team id of 0 if no-team
|
||||
|
|
@ -552,6 +554,7 @@ ON DUPLICATE KEY UPDATE
|
|||
installer.PreInstallQuery,
|
||||
postInstallScriptID,
|
||||
installer.Platform,
|
||||
installer.SelfService,
|
||||
installer.Title,
|
||||
installer.Source,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9555,7 +9555,7 @@ func (s *integrationEnterpriseTestSuite) TestApplyTeamsSoftwareConfig() {
|
|||
require.Empty(t, teamResp.Team.Config.Software.Value)
|
||||
}
|
||||
|
||||
func (s *integrationMDMTestSuite) TestBatchSetSoftwareInstallers() {
|
||||
func (s *integrationEnterpriseTestSuite) TestBatchSetSoftwareInstallers() {
|
||||
t := s.T()
|
||||
|
||||
// a team name is required (we don't allow installers for "no team")
|
||||
|
|
@ -9620,6 +9620,14 @@ func (s *integrationMDMTestSuite) TestBatchSetSoftwareInstallers() {
|
|||
s.DoJSON("GET", "/api/v1/fleet/software/titles", nil, http.StatusOK, &newTitlesResp, "available_for_install", "true", "team_id", strconv.Itoa(int(tm.ID)))
|
||||
require.Equal(t, titlesResp, newTitlesResp)
|
||||
|
||||
// setting self-service to true updates the software title metadata
|
||||
softwareToInstall[0].SelfService = true
|
||||
s.Do("POST", "/api/latest/fleet/software/batch", batchSetSoftwareInstallersRequest{Software: softwareToInstall}, http.StatusNoContent, "team_name", tm.Name)
|
||||
newTitlesResp = listSoftwareTitlesResponse{}
|
||||
s.DoJSON("GET", "/api/v1/fleet/software/titles", nil, http.StatusOK, &newTitlesResp, "available_for_install", "true", "team_id", strconv.Itoa(int(tm.ID)))
|
||||
titlesResp.SoftwareTitles[0].SelfService = true
|
||||
require.Equal(t, titlesResp, newTitlesResp)
|
||||
|
||||
// empty payload cleans the software items
|
||||
softwareToInstall = []fleet.SoftwareInstallerPayload{}
|
||||
s.Do("POST", "/api/latest/fleet/software/batch", batchSetSoftwareInstallersRequest{Software: softwareToInstall}, http.StatusNoContent, "team_name", tm.Name)
|
||||
|
|
|
|||
Loading…
Reference in a new issue