Ejemplo n.º 1
0
    def test_get_defaults(self):
        """Testing SiteConfiguration.get_defaults"""
        SiteConfiguration.add_global_defaults({
            'valid_key_1': 'global_value_1',
            'valid_key_2': 'global_value_2',
            'valid_key_3': 'global_value_3',
        })
        SiteConfiguration.add_global_default('valid_key_1', 'new_global_value')

        try:
            siteconfig_defaults = SiteConfiguration.get_global_defaults()
            self.assertEqual(siteconfig_defaults['valid_key_1'],
                             'new_global_value')
            self.assertEqual(siteconfig_defaults['valid_key_2'],
                             'global_value_2')
            self.assertEqual(siteconfig_defaults['valid_key_3'],
                             'global_value_3')
        finally:
            SiteConfiguration.remove_global_default('valid_key_1')
            SiteConfiguration.remove_global_default('valid_key_2')
            SiteConfiguration.remove_global_default('valid_key_3')
Ejemplo n.º 2
0
    def test_get_defaults(self):
        """Testing SiteConfiguration.get_defaults"""
        SiteConfiguration.add_global_defaults({
            'valid_key_1': 'global_value_1',
            'valid_key_2': 'global_value_2',
            'valid_key_3': 'global_value_3',
        })
        SiteConfiguration.add_global_default('valid_key_1', 'new_global_value')

        try:
            siteconfig_defaults = SiteConfiguration.get_global_defaults()
            self.assertEqual(siteconfig_defaults['valid_key_1'],
                             'new_global_value')
            self.assertEqual(siteconfig_defaults['valid_key_2'],
                             'global_value_2')
            self.assertEqual(siteconfig_defaults['valid_key_3'],
                             'global_value_3')
        finally:
            SiteConfiguration.remove_global_default('valid_key_1')
            SiteConfiguration.remove_global_default('valid_key_2')
            SiteConfiguration.remove_global_default('valid_key_3')