| 1 | # |
| 2 | # Copyright (C) 2019 EfficiOS Inc. |
| 3 | # |
| 4 | # This program is free software; you can redistribute it and/or |
| 5 | # modify it under the terms of the GNU General Public License |
| 6 | # as published by the Free Software Foundation; only version 2 |
| 7 | # of the License. |
| 8 | # |
| 9 | # This program is distributed in the hope that it will be useful, |
| 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | # GNU General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU General Public License |
| 15 | # along with this program; if not, write to the Free Software |
| 16 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | # |
| 18 | |
| 19 | import unittest |
| 20 | import bt2 |
| 21 | import os |
| 22 | |
| 23 | |
| 24 | class PythonPluginProviderTestCase(unittest.TestCase): |
| 25 | def test_python_plugin_provider(self): |
| 26 | path = os.environ['PYTHON_PLUGIN_PROVIDER_TEST_PLUGIN_PATH'] |
| 27 | pset = bt2.find_plugins_in_path(path) |
| 28 | self.assertEqual(len(pset), 1) |
| 29 | plugin = pset[0] |
| 30 | self.assertEqual(plugin.name, 'sparkling') |
| 31 | self.assertEqual(plugin.author, 'Philippe Proulx') |
| 32 | self.assertEqual(plugin.description, 'A delicious plugin.') |
| 33 | self.assertEqual(plugin.version.major, 1) |
| 34 | self.assertEqual(plugin.version.minor, 2) |
| 35 | self.assertEqual(plugin.version.patch, 3) |
| 36 | self.assertEqual(plugin.version.extra, 'EXTRA') |
| 37 | self.assertEqual(plugin.license, 'MIT') |
| 38 | self.assertEqual(len(plugin.source_component_classes), 1) |
| 39 | self.assertEqual(len(plugin.filter_component_classes), 1) |
| 40 | self.assertEqual(len(plugin.sink_component_classes), 1) |
| 41 | self.assertEqual(plugin.source_component_classes['MySource'].name, 'MySource') |
| 42 | self.assertEqual(plugin.filter_component_classes['MyFilter'].name, 'MyFilter') |
| 43 | self.assertEqual(plugin.sink_component_classes['MySink'].name, 'MySink') |