test_macdefaults.py 1.0 KB

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