def test_get_set_primary_group(test_file): result = win_dacl.set_primary_group( obj_name=str(test_file), principal="Backup Operators", obj_type="file" ) assert result is True result = win_dacl.get_primary_group(obj_name=str(test_file), obj_type="file") assert result == "Backup Operators"
def test_get_set_primary_group(reg_key): result = win_dacl.set_primary_group(obj_name=reg_key, principal="Backup Operators", obj_type="registry") assert result is True result = win_dacl.get_primary_group(obj_name=reg_key, obj_type="registry") assert result == "Backup Operators"
def test_copy_security(): with pytest.helpers.temp_file("source_test.file") as source: # Set permissions on Source result = win_dacl.set_permissions( obj_name=str(source), principal="Backup Operators", permissions="full_control", access_mode="grant", obj_type="file", reset_perms=False, protected=None, ) assert result is True # Set owner on Source result = win_dacl.set_owner(obj_name=str(source), principal="Backup Operators", obj_type="file") assert result is True # Set group on Source result = win_dacl.set_primary_group(obj_name=str(source), principal="Backup Operators", obj_type="file") assert result is True with pytest.helpers.temp_file("target_test.file") as target: # Copy security from Source to Target result = win_dacl.copy_security(source=str(source), target=str(target)) assert result is True # Verify permissions on Target expected = { "Not Inherited": { "Backup Operators": { "grant": { "applies to": "This folder only", "permissions": "Full control", } } } } result = win_dacl.get_permissions( obj_name=str(target), principal="Backup Operators", obj_type="file", ) assert result == expected # Verify owner on Target result = win_dacl.get_owner(obj_name=str(target), obj_type="file") assert result == "Backup Operators" # Verify group on Target result = win_dacl.get_primary_group(obj_name=str(target), obj_type="file") assert result == "Backup Operators"
def test_primary_group(self): ''' Test the set_primary_group function Test the get_primary_group function ''' self.assertTrue(win_dacl.set_primary_group(obj_name=self.obj_name, principal='Backup Operators', obj_type=self.obj_type)) self.assertEqual(win_dacl.get_primary_group(obj_name=self.obj_name, obj_type=self.obj_type), 'Backup Operators')
def test_primary_group(self): """ Test the set_primary_group function Test the get_primary_group function """ self.assertTrue( win_dacl.set_primary_group( obj_name=self.obj_name, principal="Backup Operators", obj_type=self.obj_type, ) ) self.assertEqual( win_dacl.get_primary_group(obj_name=self.obj_name, obj_type=self.obj_type), "Backup Operators", )