Ejemplo n.º 1
0
 def test_get_by_release(self):
     release = self.env.create_release(
         version='2015.1-8.0',
         operating_system='Ubuntu',
         modes=[consts.CLUSTER_MODES.ha_compact])
     for plugin in PluginCollection.get_by_release(release):
         self.assertNotEqual(plugin.name, 'incompatible_plugin')
Ejemplo n.º 2
0
 def test_get_by_uids(self):
     plugin_ids = self._create_test_plugins()
     ids = plugin_ids[:2]
     plugins = PluginCollection.get_by_uids(ids)
     self.assertEqual(len(list(plugins)), 2)
     self.assertListEqual(
         [plugin.id for plugin in plugins], ids)
Ejemplo n.º 3
0
    def test_all_newest(self):
        for version in ['1.0.0', '2.0.0', '0.0.1']:
            plugin_data = self.env.get_default_plugin_metadata(
                version=version,
                name='multiversion_plugin')
            Plugin.create(plugin_data)

        single_plugin_data = self.env.get_default_plugin_metadata(
            name='single_plugin')
        Plugin.create(single_plugin_data)

        newest_plugins = PluginCollection.all_newest()
        self.assertEqual(len(newest_plugins), 2)

        single_plugin = filter(
            lambda p: p.name == 'single_plugin',
            newest_plugins)
        multiversion_plugin = filter(
            lambda p: p.name == 'multiversion_plugin',
            newest_plugins)

        self.assertEqual(len(single_plugin), 1)
        self.assertEqual(len(multiversion_plugin), 1)

        self.assertEqual(multiversion_plugin[0].version, '2.0.0')
    def test_all_newest(self):
        self._create_test_plugins()

        newest_plugins = PluginCollection.all_newest()
        self.assertEqual(len(newest_plugins), 3)

        single_plugin = filter(lambda p: p.name == "single_plugin", newest_plugins)
        multiversion_plugin = filter(lambda p: p.name == "multiversion_plugin", newest_plugins)

        self.assertEqual(len(single_plugin), 1)
        self.assertEqual(len(multiversion_plugin), 1)

        self.assertEqual(multiversion_plugin[0].version, "5.0.0")
Ejemplo n.º 5
0
    def test_all_newest(self):
        newest_plugins = PluginCollection.all_newest()
        self.assertEqual(len(newest_plugins), 2)

        single_plugin = filter(
            lambda p: p.name == 'single_plugin',
            newest_plugins)
        multiversion_plugin = filter(
            lambda p: p.name == 'multiversion_plugin',
            newest_plugins)

        self.assertEqual(len(single_plugin), 1)
        self.assertEqual(len(multiversion_plugin), 1)

        self.assertEqual(multiversion_plugin[0].version, '3.0.0')
Ejemplo n.º 6
0
    def test_all_newest(self):
        self._create_test_plugins()

        newest_plugins = PluginCollection.all_newest()
        self.assertEqual(len(newest_plugins), 3)

        single_plugin = filter(
            lambda p: p.name == 'single_plugin',
            newest_plugins)
        multiversion_plugin = filter(
            lambda p: p.name == 'multiversion_plugin',
            newest_plugins)

        self.assertEqual(len(single_plugin), 1)
        self.assertEqual(len(multiversion_plugin), 1)

        self.assertEqual(multiversion_plugin[0].version, '3.0.0')
Ejemplo n.º 7
0
    def test_all_newest(self):
        for version in ['1.0.0', '2.0.0', '0.0.1']:
            plugin_data = self.env.get_default_plugin_metadata(
                version=version, name='multiversion_plugin')
            Plugin.create(plugin_data)

        single_plugin_data = self.env.get_default_plugin_metadata(
            name='single_plugin')
        Plugin.create(single_plugin_data)

        newest_plugins = PluginCollection.all_newest()
        self.assertEqual(len(newest_plugins), 2)

        single_plugin = filter(lambda p: p.name == 'single_plugin',
                               newest_plugins)
        multiversion_plugin = filter(lambda p: p.name == 'multiversion_plugin',
                                     newest_plugins)

        self.assertEqual(len(single_plugin), 1)
        self.assertEqual(len(multiversion_plugin), 1)

        self.assertEqual(multiversion_plugin[0].version, '2.0.0')
Ejemplo n.º 8
0
 def test_get_by_uids(self):
     plugin_ids = self._create_test_plugins()
     ids = plugin_ids[:2]
     plugins = PluginCollection.get_by_uids(ids)
     self.assertItemsEqual(ids, (plugin.id for plugin in plugins))
Ejemplo n.º 9
0
 def test_get_by_uids(self):
     plugin_ids = self._create_test_plugins()
     ids = plugin_ids[:2]
     plugins = PluginCollection.get_by_uids(ids)
     self.assertItemsEqual(ids, (plugin.id for plugin in plugins))
Ejemplo n.º 10
0
 def test_get_by_uids(self):
     plugin_ids = self._create_test_plugins()
     ids = plugin_ids[:2]
     plugins = PluginCollection.get_by_uids(ids)
     self.assertEqual(len(list(plugins)), 2)
     self.assertListEqual([plugin.id for plugin in plugins], ids)