1
0

test_macdefaults.py 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. # -*- coding: utf-8 -*-
  2. """
  3. Validate the mac-defaults module
  4. """
  5. from __future__ import absolute_import, print_function, unicode_literals
  6. from tests.support.case import ModuleCase
  7. from tests.support.helpers import destructiveTest, runs_on, skip_if_not_root
  8. DEFAULT_DOMAIN = "com.apple.AppleMultitouchMouse"
  9. DEFAULT_KEY = "MouseHorizontalScroll"
  10. DEFAULT_VALUE = "0"
  11. @destructiveTest
  12. @skip_if_not_root
  13. @runs_on(kernel="Darwin")
  14. class MacDefaultsModuleTest(ModuleCase):
  15. """
  16. Integration tests for the mac_default module
  17. """
  18. def test_macdefaults_write_read(self):
  19. """
  20. Tests that writes and reads macdefaults
  21. """
  22. write_domain = self.run_function(
  23. "macdefaults.write", [DEFAULT_DOMAIN, DEFAULT_KEY, DEFAULT_VALUE]
  24. )
  25. self.assertTrue(write_domain)
  26. read_domain = self.run_function(
  27. "macdefaults.read", [DEFAULT_DOMAIN, DEFAULT_KEY]
  28. )
  29. self.assertTrue(read_domain)
  30. self.assertEqual(read_domain, DEFAULT_VALUE)