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'])
    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'])
Exemple #3
0
 def test_save_resolution(self):
     ap = ResolutionAdminPanel(self.env)
     self._test_save('invalid', 'invalid!!')
     self._test_save('invalid!!', ' in \t valid ', 'in valid')
     self._test_save_non_unique('wontfix', 'fixed')
     self._test_save_non_unique('wontfix', ' in \t valid ', 'in valid')
Exemple #4
0
 def setUp(self):
     super(ResolutionAdminPanelTestCase, self).setUp()
     self.admin = ResolutionAdminPanel(self.env)
Exemple #5
0
 def test_remove_default_resolution(self):
     ap = ResolutionAdminPanel(self.env)
     self._test_remove_default(ap, 'invalid')
Exemple #6
0
 def test_add_resolution(self):
     ap = ResolutionAdminPanel(self.env)
     self._test_add(ap, 'resolution 1')
 def list_resolution_in_json(self):
     panel = ResolutionAdminPanel(self.env)
     printout(json.dumps(panel.get_enum_list()))
Exemple #8
0
 def setUp(self):
     super().setUp()
     self.admin = ResolutionAdminPanel(self.env)