示例#1
0
    def testAddPreregisteredChoice(self):
        """Test that we can register choices before the config is actually set up."""
        config_add_choice('ctg1', 'c1', ('a', 'Item A'))
        config_add_choice('ctg1', 'c1', ('b', 'Item B'))
        config_add_choice('ctg1', 'c1', ('c', 'Item C'))

        g1 = ConfigurationGroup('ctg1', 'Choice 1', ordering=1000)
        config_register(StringValue(g1, 'c1'))

        c = config_get('ctg1', 'c1')

        self.assertEqual(c.choices, [('a', 'Item A'), ('b', 'Item B'), ('c', 'Item C')])
示例#2
0
    def testAddPreregisteredChoice(self):
        """Test that we can register choices before the config is actually set up."""
        config_add_choice('ctg1', 'c1', ('a', 'Item A'))
        config_add_choice('ctg1', 'c1', ('b', 'Item B'))
        config_add_choice('ctg1', 'c1', ('c', 'Item C'))

        g1 = ConfigurationGroup('ctg1', 'Choice 1', ordering=1000)
        config_register(StringValue(g1, 'c1'))

        c = config_get('ctg1', 'c1')

        self.assertEqual(c.choices, [('a', 'Item A'), ('b', 'Item B'), ('c', 'Item C')])
示例#3
0
    def testAddChoice(self):

        config_add_choice('m1', 'c1', (4, 'four'))
        c = config_get('m1', 'c1')
        self.assertEqual(c.choices,
                         ((1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')))
示例#4
0
 def testAddChoice(self):
     config_add_choice('m1', 'c1', (4, 'four'))
     c = config_get('m1', 'c1')
     self.assertEqual(c.choices, ((1, 'one'), (2, 'two'), (3, 'three'), (4, 'four')))