diff --git a/server/datastore/mysql/apple_mdm_test.go b/server/datastore/mysql/apple_mdm_test.go index 541ee5153a..0c593974f4 100644 --- a/server/datastore/mysql/apple_mdm_test.go +++ b/server/datastore/mysql/apple_mdm_test.go @@ -39,41 +39,41 @@ func TestMDMApple(t *testing.T) { name string fn func(t *testing.T, ds *Datastore) }{ - // {"TestNewMDMAppleConfigProfileDuplicateName", testNewMDMAppleConfigProfileDuplicateName}, - // {"TestNewMDMAppleConfigProfileLabels", testNewMDMAppleConfigProfileLabels}, - // {"TestNewMDMAppleConfigProfileDuplicateIdentifier", testNewMDMAppleConfigProfileDuplicateIdentifier}, - // {"TestDeleteMDMAppleConfigProfile", testDeleteMDMAppleConfigProfile}, - // {"TestDeleteMDMAppleConfigProfileByTeamAndIdentifier", testDeleteMDMAppleConfigProfileByTeamAndIdentifier}, - // {"TestListMDMAppleConfigProfiles", testListMDMAppleConfigProfiles}, - // {"TestHostDetailsMDMProfiles", testHostDetailsMDMProfiles}, - // {"TestBatchSetMDMAppleProfiles", testBatchSetMDMAppleProfiles}, - // {"TestMDMAppleProfileManagement", testMDMAppleProfileManagement}, - // {"TestMDMAppleProfileManagementBatch2", testMDMAppleProfileManagementBatch2}, - // {"TestMDMAppleProfileManagementBatch3", testMDMAppleProfileManagementBatch3}, - // {"TestGetMDMAppleProfilesContents", testGetMDMAppleProfilesContents}, - // {"TestAggregateMacOSSettingsStatusWithFileVault", testAggregateMacOSSettingsStatusWithFileVault}, - // {"TestMDMAppleHostsProfilesStatus", testMDMAppleHostsProfilesStatus}, - // {"TestMDMAppleIdPAccount", testMDMAppleIdPAccount}, - // {"TestIgnoreMDMClientError", testDoNotIgnoreMDMClientError}, - // {"TestDeleteMDMAppleProfilesForHost", testDeleteMDMAppleProfilesForHost}, - // {"TestGetMDMAppleCommandResults", testGetMDMAppleCommandResults}, - // {"TestBulkUpsertMDMAppleConfigProfiles", testBulkUpsertMDMAppleConfigProfile}, - // {"TestMDMAppleBootstrapPackageCRUD", testMDMAppleBootstrapPackageCRUD}, - // {"TestListMDMAppleCommands", testListMDMAppleCommands}, - // {"TestMDMAppleSetupAssistant", testMDMAppleSetupAssistant}, - // {"TestMDMAppleEnrollmentProfile", testMDMAppleEnrollmentProfile}, - // {"TestListMDMAppleSerials", testListMDMAppleSerials}, - // {"TestMDMAppleDefaultSetupAssistant", testMDMAppleDefaultSetupAssistant}, - // {"TestSetVerifiedMacOSProfiles", testSetVerifiedMacOSProfiles}, - // {"TestMDMAppleConfigProfileHash", testMDMAppleConfigProfileHash}, - // {"TestMDMAppleResetEnrollment", testMDMAppleResetEnrollment}, - // {"TestMDMAppleDeleteHostDEPAssignments", testMDMAppleDeleteHostDEPAssignments}, - // {"LockUnlockWipeMacOS", testLockUnlockWipeMacOS}, - // {"ScreenDEPAssignProfileSerialsForCooldown", testScreenDEPAssignProfileSerialsForCooldown}, - // {"MDMAppleDDMDeclarationsToken", testMDMAppleDDMDeclarationsToken}, - // {"MDMAppleSetPendingDeclarationsAs", testMDMAppleSetPendingDeclarationsAs}, - // {"SetOrUpdateMDMAppleDeclaration", testSetOrUpdateMDMAppleDDMDeclaration}, - // {"DEPAssignmentUpdates", testMDMAppleDEPAssignmentUpdates}, + {"TestNewMDMAppleConfigProfileDuplicateName", testNewMDMAppleConfigProfileDuplicateName}, + {"TestNewMDMAppleConfigProfileLabels", testNewMDMAppleConfigProfileLabels}, + {"TestNewMDMAppleConfigProfileDuplicateIdentifier", testNewMDMAppleConfigProfileDuplicateIdentifier}, + {"TestDeleteMDMAppleConfigProfile", testDeleteMDMAppleConfigProfile}, + {"TestDeleteMDMAppleConfigProfileByTeamAndIdentifier", testDeleteMDMAppleConfigProfileByTeamAndIdentifier}, + {"TestListMDMAppleConfigProfiles", testListMDMAppleConfigProfiles}, + {"TestHostDetailsMDMProfiles", testHostDetailsMDMProfiles}, + {"TestBatchSetMDMAppleProfiles", testBatchSetMDMAppleProfiles}, + {"TestMDMAppleProfileManagement", testMDMAppleProfileManagement}, + {"TestMDMAppleProfileManagementBatch2", testMDMAppleProfileManagementBatch2}, + {"TestMDMAppleProfileManagementBatch3", testMDMAppleProfileManagementBatch3}, + {"TestGetMDMAppleProfilesContents", testGetMDMAppleProfilesContents}, + {"TestAggregateMacOSSettingsStatusWithFileVault", testAggregateMacOSSettingsStatusWithFileVault}, + {"TestMDMAppleHostsProfilesStatus", testMDMAppleHostsProfilesStatus}, + {"TestMDMAppleIdPAccount", testMDMAppleIdPAccount}, + {"TestIgnoreMDMClientError", testDoNotIgnoreMDMClientError}, + {"TestDeleteMDMAppleProfilesForHost", testDeleteMDMAppleProfilesForHost}, + {"TestGetMDMAppleCommandResults", testGetMDMAppleCommandResults}, + {"TestBulkUpsertMDMAppleConfigProfiles", testBulkUpsertMDMAppleConfigProfile}, + {"TestMDMAppleBootstrapPackageCRUD", testMDMAppleBootstrapPackageCRUD}, + {"TestListMDMAppleCommands", testListMDMAppleCommands}, + {"TestMDMAppleSetupAssistant", testMDMAppleSetupAssistant}, + {"TestMDMAppleEnrollmentProfile", testMDMAppleEnrollmentProfile}, + {"TestListMDMAppleSerials", testListMDMAppleSerials}, + {"TestMDMAppleDefaultSetupAssistant", testMDMAppleDefaultSetupAssistant}, + {"TestSetVerifiedMacOSProfiles", testSetVerifiedMacOSProfiles}, + {"TestMDMAppleConfigProfileHash", testMDMAppleConfigProfileHash}, + {"TestMDMAppleResetEnrollment", testMDMAppleResetEnrollment}, + {"TestMDMAppleDeleteHostDEPAssignments", testMDMAppleDeleteHostDEPAssignments}, + {"LockUnlockWipeMacOS", testLockUnlockWipeMacOS}, + {"ScreenDEPAssignProfileSerialsForCooldown", testScreenDEPAssignProfileSerialsForCooldown}, + {"MDMAppleDDMDeclarationsToken", testMDMAppleDDMDeclarationsToken}, + {"MDMAppleSetPendingDeclarationsAs", testMDMAppleSetPendingDeclarationsAs}, + {"SetOrUpdateMDMAppleDeclaration", testSetOrUpdateMDMAppleDDMDeclaration}, + {"DEPAssignmentUpdates", testMDMAppleDEPAssignmentUpdates}, {"TestInsertMDMAsset", testInsertMDMAsset}, } diff --git a/server/mock/datastore_mock.go b/server/mock/datastore_mock.go index ee251dce6a..f760447715 100644 --- a/server/mock/datastore_mock.go +++ b/server/mock/datastore_mock.go @@ -821,6 +821,8 @@ type MDMAppleStoreDDMStatusReportFunc func(ctx context.Context, hostUUID string, type MDMAppleSetPendingDeclarationsAsFunc func(ctx context.Context, hostUUID string, status *fleet.MDMDeliveryStatus, detail string) error +type InsertMDMConfigAssetsFunc func(ctx context.Context, assets []fleet.MDMConfigAsset) error + type WSTEPStoreCertificateFunc func(ctx context.Context, name string, crt *x509.Certificate) error type WSTEPNewSerialFunc func(ctx context.Context) (*big.Int, error) @@ -2157,6 +2159,9 @@ type DataStore struct { MDMAppleSetPendingDeclarationsAsFunc MDMAppleSetPendingDeclarationsAsFunc MDMAppleSetPendingDeclarationsAsFuncInvoked bool + InsertMDMConfigAssetsFunc InsertMDMConfigAssetsFunc + InsertMDMConfigAssetsFuncInvoked bool + WSTEPStoreCertificateFunc WSTEPStoreCertificateFunc WSTEPStoreCertificateFuncInvoked bool @@ -5165,6 +5170,13 @@ func (s *DataStore) MDMAppleSetPendingDeclarationsAs(ctx context.Context, hostUU return s.MDMAppleSetPendingDeclarationsAsFunc(ctx, hostUUID, status, detail) } +func (s *DataStore) InsertMDMConfigAssets(ctx context.Context, assets []fleet.MDMConfigAsset) error { + s.mu.Lock() + s.InsertMDMConfigAssetsFuncInvoked = true + s.mu.Unlock() + return s.InsertMDMConfigAssetsFunc(ctx, assets) +} + func (s *DataStore) WSTEPStoreCertificate(ctx context.Context, name string, crt *x509.Certificate) error { s.mu.Lock() s.WSTEPStoreCertificateFuncInvoked = true