2016-03-10 23:34:18 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
'''
|
|
|
|
Validate the mac-defaults module
|
|
|
|
'''
|
2016-03-16 17:44:55 +00:00
|
|
|
|
2016-03-10 23:34:18 +00:00
|
|
|
# Import Python Libs
|
2016-03-17 02:58:41 +00:00
|
|
|
from __future__ import absolute_import
|
2016-03-10 23:34:18 +00:00
|
|
|
|
|
|
|
# Import Salt Testing Libs
|
2017-04-03 16:04:09 +00:00
|
|
|
from tests.support.case import ModuleCase
|
2017-04-04 17:57:27 +00:00
|
|
|
from tests.support.helpers import destructiveTest, skip_if_not_root
|
2016-03-10 23:34:18 +00:00
|
|
|
|
|
|
|
DEFAULT_DOMAIN = 'com.apple.AppleMultitouchMouse'
|
|
|
|
DEFAULT_KEY = 'MouseHorizontalScroll'
|
|
|
|
DEFAULT_VALUE = '0'
|
|
|
|
|
2016-03-17 15:01:59 +00:00
|
|
|
|
2017-03-29 18:15:15 +00:00
|
|
|
@destructiveTest
|
2017-04-04 17:57:27 +00:00
|
|
|
@skip_if_not_root
|
2017-04-03 16:04:09 +00:00
|
|
|
class MacDefaultsModuleTest(ModuleCase):
|
2016-03-10 23:34:18 +00:00
|
|
|
'''
|
|
|
|
Integration tests for the mac_default module
|
|
|
|
'''
|
|
|
|
def setUp(self):
|
|
|
|
'''
|
|
|
|
Sets up the test requirements
|
|
|
|
'''
|
|
|
|
os_grain = self.run_function('grains.item', ['kernel'])
|
|
|
|
# Must be running on a mac
|
|
|
|
if os_grain['kernel'] not in 'Darwin':
|
|
|
|
self.skipTest(
|
|
|
|
'Test not applicable to \'{kernel}\' kernel'.format(
|
|
|
|
**os_grain
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2017-03-29 18:15:15 +00:00
|
|
|
def test_macdefaults_write_read(self):
|
2016-03-10 23:34:18 +00:00
|
|
|
'''
|
|
|
|
Tests that writes and reads macdefaults
|
|
|
|
'''
|
|
|
|
write_domain = self.run_function('macdefaults.write',
|
|
|
|
[DEFAULT_DOMAIN,
|
|
|
|
DEFAULT_KEY,
|
|
|
|
DEFAULT_VALUE])
|
|
|
|
self.assertTrue(write_domain)
|
|
|
|
|
|
|
|
read_domain = self.run_function('macdefaults.read',
|
|
|
|
[DEFAULT_DOMAIN,
|
|
|
|
DEFAULT_KEY])
|
|
|
|
self.assertTrue(read_domain)
|
|
|
|
self.assertEqual(read_domain, DEFAULT_VALUE)
|