def test_reorder_field_values(self):
        """
        test that field values are reordered to match configuration
        """
        # We create an instance of the panel so we can check existing values
        panel = ResolutionAdminPanel(self.env)

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

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

        admin_command = TicketFieldConfigCommand(self.env)

        # run our plugin
        admin_command.set_fields_from_config()

        # assert order was adjusted
        self.assertEqual(panel.get_enum_list(), self.new['resolution'])
コード例 #2
0
    def test_resolution_set_successful(self):
        """
        When we add custom resolution enum values to the config
        and call TicketFieldConfigCommand.set_fields_from_config()
        we expect the Trac environments resolution 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 = ResolutionAdminPanel(self.env)

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

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

        admin_command = TicketFieldConfigCommand(self.env)

        # run our plugin
        admin_command.set_fields_from_config()

        self.assertItemsEqual(panel.get_enum_list(), self.new['resolution'])
コード例 #3
0
 def list_resolution_in_json(self):
     panel = ResolutionAdminPanel(self.env)
     printout(json.dumps(panel.get_enum_list()))