Ejemplo n.º 1
0
 def test_add_with_label(self):
     Configuration.add('new-group',
                       label="One label",
                       function_=fnct_configuration)
     self.assertAdded('new-group',
                      label="One label",
                      function_=fnct_configuration)
Ejemplo n.º 2
0
 def test_merge_label(self):
     Configuration.add('new-group', label="Label 1",
                       function_=fnct_other_configuration)
     Configuration.add('old-group', label="Label 2", part='other',
                       function_=fnct_configuration)
     labels = Configuration._merge_labels('bloks')
     self.assertEqual(labels, {'new-group': "Label 1"})
Ejemplo n.º 3
0
 def test_remove_label(self):
     Configuration.add('new-group',
                       label="One label",
                       function_=fnct_configuration)
     Configuration.remove_label('new-group')
     with self.assertRaises(KeyError):
         Configuration.labels['AnyBlok']['new-group']
Ejemplo n.º 4
0
    def test_add_application_properties_and_load_it(self):
        Configuration.add_application_properties(
            'test_add_application_properties', ['logging'])
        parser = MockArgumentParser()

        # add twice to check doublon
        Configuration.add('logging', function_=add_logging, label='Logging')
        Configuration.add('logging', function_=add_logging, label='Logging')

        Configuration.add('database', function_=add_database, label='Database')
        Configuration.add('config', function_=add_configuration_file)
        Configuration.add('install-bloks', function_=add_install_bloks)
        Configuration._load(parser, ['config', 'database', 'logging'])
Ejemplo n.º 5
0
    def test_add_application_properties_and_load_it(self):
        Configuration.add_application_properties(
            'test_add_application_properties', ['logging'])
        parser = MockArgumentParser()

        # add twice to check doublon
        Configuration.add('logging', function_=add_logging, label='Logging')
        Configuration.add('logging', function_=add_logging, label='Logging')

        Configuration.add('database', function_=add_database, label='Database')
        Configuration.add('config', function_=add_configuration_file)
        Configuration.add('install-bloks', function_=add_install_bloks)
        Configuration._load(parser, ['config', 'database', 'logging'])
Ejemplo n.º 6
0
 def test_merge_for_more_parts(self):
     Configuration.add('new-group', function_=fnct_configuration)
     Configuration.add('new-group', function_=fnct_other_configuration)
     Configuration.add('old-group', function_=fnct_configuration)
     Configuration.add('old-group', part='other',
                       function_=fnct_other_configuration)
     groups = Configuration._merge_groups('bloks', 'other')
     self.assertEqual(groups, {
         'new-group': [fnct_configuration, fnct_other_configuration],
         'old-group': [fnct_configuration, fnct_other_configuration]})
Ejemplo n.º 7
0
 def test_remove_more_function(self):
     Configuration.add('new-group', function_=fnct_configuration)
     Configuration.add('new-group', function_=fnct_other_configuration)
     Configuration.remove('new-group', function_=fnct_configuration)
     self.assertEqual(Configuration.groups['bloks']['new-group'],
                      [fnct_other_configuration])
Ejemplo n.º 8
0
 def test_remove_other_part(self):
     Configuration.add('new-group', part='other',
                       function_=fnct_configuration)
     Configuration.remove('new-group', part='other',
                          function_=fnct_configuration)
     self.assertEqual(Configuration.groups['other']['new-group'], [])
Ejemplo n.º 9
0
 def test_initialize_logging(self):
     Configuration.add('logging', function_=add_logging, label='Logging')
     Configuration.set('logging_level', 'DEBUG')
     Configuration.set('logging_level_qualnames', ['test'])
     Configuration.initialize_logging()
Ejemplo n.º 10
0
 def test_add_other_part_with_label(self):
     Configuration.add('new-group', part='other', label="One label",
                       function_=fnct_configuration)
     self.assertAdded('new-group', part='other', label="One label",
                      function_=fnct_configuration)
Ejemplo n.º 11
0
 def test_add_other_part(self):
     Configuration.add(
         'new-group', part='other', function_=fnct_configuration)
     self.assertAdded('new-group', part='other',
                      function_=fnct_configuration)
Ejemplo n.º 12
0
 def test_add(self):
     Configuration.add('new-group', function_=fnct_configuration)
     self.assertAdded('new-group', function_=fnct_configuration)
Ejemplo n.º 13
0
 def test_initialize_logging(self):
     Configuration.add('logging', function_=add_logging, label='Logging')
     Configuration.set('logging_level', 'DEBUG')
     Configuration.set('logging_level_qualnames', ['test'])
     Configuration.initialize_logging()
Ejemplo n.º 14
0
 def test_remove_label(self):
     Configuration.add(
         'new-group', label="One label", function_=fnct_configuration)
     Configuration.remove_label('new-group')
     with self.assertRaises(KeyError):
         Configuration.labels['AnyBlok']['new-group']
Ejemplo n.º 15
0
 def test_remove_more_function(self):
     Configuration.add('new-group', function_=fnct_configuration)
     Configuration.add('new-group', function_=fnct_other_configuration)
     Configuration.remove('new-group', function_=fnct_configuration)
     self.assertEqual(Configuration.groups['new-group'],
                      [fnct_other_configuration])
Ejemplo n.º 16
0
 def test_remove(self):
     Configuration.add('new-group', function_=fnct_configuration)
     Configuration.remove('new-group', function_=fnct_configuration)
     self.assertEqual(Configuration.groups['new-group'], [])
Ejemplo n.º 17
0
 def test_remove(self):
     Configuration.add('new-group', function_=fnct_configuration)
     Configuration.remove('new-group', function_=fnct_configuration)
     assert Configuration.groups['new-group'] == []
Ejemplo n.º 18
0
 def test_add(self):
     Configuration.add('new-group', function_=fnct_configuration)
     self.assertAdded('new-group', function_=fnct_configuration)
Ejemplo n.º 19
0
 def test_remove_more_function(self):
     Configuration.add('new-group', function_=fnct_configuration)
     Configuration.add('new-group', function_=fnct_other_configuration)
     Configuration.remove('new-group', function_=fnct_configuration)
     assert Configuration.groups['new-group'] == [fnct_other_configuration]
Ejemplo n.º 20
0
 def test_remove_label_other_part(self):
     Configuration.add('new-group', part='other', label="One label",
                       function_=fnct_configuration)
     Configuration.remove_label('new-group', part='other')
     with self.assertRaises(KeyError):
         Configuration.labels['other']['new-group']
Ejemplo n.º 21
0
 def test_remove(self):
     Configuration.add('new-group', function_=fnct_configuration)
     Configuration.remove('new-group', function_=fnct_configuration)
     self.assertEqual(Configuration.groups['new-group'], [])