コード例 #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
ファイル: test_mac_assistive.py プロジェクト: MalloZup/salt-2
 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
ファイル: mac_assistive_test.py プロジェクト: bryson/salt
 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
ファイル: mac_assistive_test.py プロジェクト: bryson/salt
 def test_enable_false(self):
     '''
     Test return of enable function when app isn't found.
     '''
     self.assertFalse(assistive.enable('foo'))