Example #1
0
 def test_extend_same_name_doesnt_conflict(self):
     config = self.config
     config.add_directive('dummy_extend', dummy_extend)
     config.add_directive('dummy_extend', dummy_extend2)
     self.assertTrue(hasattr(config, 'dummy_extend'))
     config.dummy_extend('discrim')
     after = config.action_state
     action = after.actions[-1]
     self.assertEqual(action['discriminator'], 'discrim')
     self.assertEqual(action['callable'], None)
     self.assertEqual(action['args'], config.registry)
Example #2
0
 def test_extend_same_name_doesnt_conflict(self):
     config = self.config
     config.add_directive('dummy_extend', dummy_extend)
     config.add_directive('dummy_extend', dummy_extend2)
     self.assertTrue(hasattr(config, 'dummy_extend'))
     config.dummy_extend('discrim')
     after = config.action_state
     action = after.actions[-1]
     self.assertEqual(action['discriminator'], 'discrim')
     self.assertEqual(action['callable'], None)
     self.assertEqual(action['args'], config.registry)
Example #3
0
    def test_extend_with_python_callable(self):
        from tests import test_config

        config = self.config
        config.add_directive('dummy_extend', dummy_extend)
        self.assertTrue(hasattr(config, 'dummy_extend'))
        config.dummy_extend('discrim')
        after = config.action_state
        action = after.actions[-1]
        self.assertEqual(action['discriminator'], 'discrim')
        self.assertEqual(action['callable'], None)
        self.assertEqual(action['args'], test_config)
Example #4
0
    def test_extend_with_python_callable(self):
        from tests import test_config

        config = self.config
        config.add_directive('dummy_extend', dummy_extend)
        self.assertTrue(hasattr(config, 'dummy_extend'))
        config.dummy_extend('discrim')
        after = config.action_state
        action = after.actions[-1]
        self.assertEqual(action['discriminator'], 'discrim')
        self.assertEqual(action['callable'], None)
        self.assertEqual(action['args'], test_config)
Example #5
0
 def test_extend_action_method_successful(self):
     config = self.config
     config.add_directive('dummy_extend', dummy_extend)
     config.dummy_extend('discrim')
     config.dummy_extend('discrim')
     self.assertRaises(ConfigurationConflictError, config.commit)
Example #6
0
 def test_extend_action_method_successful(self):
     config = self.config
     config.add_directive('dummy_extend', dummy_extend)
     config.dummy_extend('discrim')
     config.dummy_extend('discrim')
     self.assertRaises(ConfigurationConflictError, config.commit)