def test_component_set_successful(self):
        """
        When we add custom component enum values to the config
        and call TicketFieldConfigCommand.set_fields_from_config()
        we expect the Trac environments component enums to be updated with our
        custom values and removal of the default values.
        """
        # We create an instance of the panel so we can check existing values
        panel = ComponentAdminPanel(self.env)

        # Check the environment initially contains the default values.
        self.assertItemsEqual(panel.get_component_list(), self.default['component'])

        # create the section, option, and values in configuration
        self.env.config.set('ticket-field-config', 'component',
                            ','.join(self.new['component']))
        # create component_owner option
        self.env.config.set('ticket-field-config','component_owner','test')

        admin_command = TicketFieldConfigCommand(self.env)

        # run our plugin
        admin_command.set_fields_from_config()

        self.assertItemsEqual(panel.get_component_list(), self.new['component'])
    def test_component_without_owner_is_trac_error(self):
        """component_owner must be specified"""
        # We create an instance of the panel so we can check existing values
        panel = ComponentAdminPanel(self.env)

        # Check the environment initially contains the default values.
        self.assertItemsEqual(panel.get_component_list(), self.default['component'])

        # create the section, option, and values in configuration
        self.env.config.set('ticket-field-config', 'component',
                            ','.join(self.new['component']))

        # we purposely forget to add component_owner to config
        # and run the plugin expecting a TracError
        admin_command = TicketFieldConfigCommand(self.env)
        self.assertRaises(TracError,admin_command.set_fields_from_config)