Пример #1
0
    def test_enable_assistive(self, get_assistive_mock):
        '''
            Test enabling a bundle ID as being allowed to run with assistive access
        '''
        get_assistive_mock.return_value = [("com.apple.Chess", '1')]
        mock = MagicMock()

        with patch.dict(assistive.__salt__, {'cmd.run': mock}):
            assistive.enable('com.apple.Chess')
            mock.assert_called_once_with(
                'sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" '
                '"UPDATE access SET allowed=\'1\' WHERE client=\'com.apple.Chess\'"'
            )
            get_assistive_mock.assert_called_once_with()
Пример #2
0
 def test_enable_false(self):
     '''
     Test return of enable function when app isn't found.
     '''
     with patch('salt.modules.mac_assistive._get_assistive_access',
                MagicMock(return_value=[])):
         self.assertFalse(assistive.enable('foo'))
Пример #3
0
 def test_enable_assistive(self):
     '''
     Test enabling a bundle ID as being allowed to run with assistive access
     '''
     mock_ret = MagicMock(return_value={'retcode': 0})
     with patch.dict(assistive.__salt__, {'cmd.run_all': mock_ret}):
         self.assertTrue(assistive.enable('foo', True))
Пример #4
0
 def test_enable_assistive(self):
     '''
     Test enabling a bundle ID as being allowed to run with assistive access
     '''
     mock_ret = MagicMock(return_value={'retcode': 0})
     with patch.dict(assistive.__salt__, {'cmd.run_all': mock_ret}):
         self.assertTrue(assistive.enable('foo', True))
Пример #5
0
 def test_enable_false(self):
     """
     Test return of enable function when app isn't found.
     """
     with patch(
         "salt.modules.mac_assistive._get_assistive_access",
         MagicMock(return_value=[]),
     ):
         self.assertFalse(assistive.enable("foo"))
Пример #6
0
 def test_enable_assistive(self):
     """
     Test enabling a bundle ID as being allowed to run with assistive access
     """
     mock_ret = MagicMock(return_value={"retcode": 0})
     with patch.dict(assistive.__salt__, {"cmd.run_all": mock_ret}), patch(
         "salt.modules.mac_assistive._get_assistive_access",
         MagicMock(return_value=[("foo", 0)]),
     ):
         self.assertTrue(assistive.enable("foo", True))
Пример #7
0
 def test_enable_false(self):
     '''
     Test return of enable function when app isn't found.
     '''
     self.assertFalse(assistive.enable('foo'))
Пример #8
0
 def test_enable_false(self):
     '''
     Test return of enable function when app isn't found.
     '''
     self.assertFalse(assistive.enable('foo'))