def GET(self, release_id): """:returns: JSONized component data for release and releated plugins. :http: * 200 (OK) """ components = ComponentCollection.get_all_by_release(release_id) return ComponentCollection.to_json(components)
def test_get_all_by_release(self): self.incompatible_plugin = self.env.create_plugin( fuel_version=['6.0'], releases=[{ 'repository_path': 'repositories/centos', 'version': '2014.2-6.0', 'os': 'centos', 'mode': ['ha'], 'deployment_scripts_path': 'deployment_scripts/'}] ) self.incompatible_release = self.env.create_release( operating_system='Ubuntu', modes=[consts.CLUSTER_MODES.ha_compact]) self.env.create_component( plugin=self.incompatible_plugin, name='incompatible_plugin_component') self.env.create_component( release=self.incompatible_release, name='incompatible_core_component') components = ComponentCollection.get_all_by_release(self.release.id) for component in components: self.assertIn( component.name, ['test_component_1', 'test_component_2']) self.assertNotIn(component.name, [ 'incompatible_plugin_component', 'incompatible_core_component']) self.assertEqual(len(components), 2)
def test_get_all_by_release(self): self.incompatible_plugin = self.env.create_plugin() self.incompatible_release = self.env.create_release( operating_system='Ubuntu', modes=[consts.CLUSTER_MODES.ha_compact]) self.env.create_component( plugin=self.incompatible_plugin, name='incompatible_plugin_component') self.env.create_component( release=self.incompatible_release, name='incompatible_core_component') components = ComponentCollection.get_all_by_release(self.release.id) for component in components: self.assertIn( component.name, ['test_component_1', 'test_component_2']) self.assertNotIn(component.name, [ 'incompatible_plugin_component', 'incompatible_core_component']) self.assertEqual(len(components), 2)