def test_get_plugin_info(self, mock_info):
     """
     Unittest to get a plugin info.
     :return:
     """
     exp_out = {
         'details': {
             'direction': 'out',
             'format': 'string',
             'args': '0640 /var/run/audispd_events',
             'active': 'no',
             'path': 'builtin_af_unix',
             'type': 'builtin'
         },
         'name': u'dummy1'
     }
     name = "dummy1"
     open_mock = mock.mock_open()
     with mock.patch('wok.plugins.ginger.model.utils.open',
                     open_mock,
                     create=True):
         audisp_plugin = PluginModel()
         mock_info.return_value = exp_out
         out = audisp_plugin.get_plugin_info(name)
         self.assertEquals(name, out['name'])
 def test_update(self, mock_del, mock_write, mock_os):
     """
     Unittest to update the plugin info.
     :param mock_del:
     :param mock_write:
     :return:
     """
     params = {"active": "yes"}
     name = 'af_uncvc'
     mock_os.return_value = True
     mock_del.return_value = {}
     mock_write.return_value = {}
     audisp_plugin = PluginModel()
     audisp_plugin.update(name, params)
 def test_update(self, mock_del, mock_write, mock_os):
     """
     Unittest to update the plugin info.
     :param mock_del:
     :param mock_write:
     :return:
     """
     params = {"active": "yes"}
     name = 'af_uncvc'
     mock_os.return_value = True
     mock_del.return_value = {}
     mock_write.return_value = {}
     audisp_plugin = PluginModel()
     audisp_plugin.update(name, params)
 def test_get_plugin_info_invalid(self, mock_isfile):
     """
     Unittest to get a plugin info.
     :return:
     """
     name = "dummy1"
     audisp_plugin = PluginModel()
     mock_isfile.return_value = False
     self.assertRaises(NotFoundError, audisp_plugin.get_plugin_info, name)
 def test_get_plugin_info(self, mock_info):
     """
     Unittest to get a plugin info.
     :return:
     """
     exp_out = {'details': {'direction': 'out',
                            'format': 'string',
                            'args': '0640 /var/run/audispd_events',
                            'active': 'no',
                            'path': 'builtin_af_unix',
                            'type': 'builtin'},
                'name': u'dummy1'}
     name = "dummy1"
     open_mock = mock.mock_open()
     with mock.patch('wok.plugins.ginger.model.utils.open',
                     open_mock, create=True):
         audisp_plugin = PluginModel()
         mock_info.return_value = exp_out
         out = audisp_plugin.get_plugin_info(name)
         self.assertEquals(name, out['name'])