Ejemplo n.º 1
0
 def test_invalid_modulename(self):
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("allmodulenoklass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("badmodule.badclass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.blah")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.BADClass")
Ejemplo n.º 2
0
 def test_invalid_modulename(self):
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("allmodulenoklass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("badmodule.badclass")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.blah")
     with self.assertRaises(ImproperlyConfigured):
         load_class_from_path("tests.BADClass")
Ejemplo n.º 3
0
def _load_zone(zone_name, **config):
    vary_klass = load_class_from_path(config['VARY'])
    return ThrottleZone(zone_name, vary_klass, **config)
Ejemplo n.º 4
0
def load_backend_from_path(classpath):
    klass = load_class_from_path(classpath)
    try:
        return klass()
    except TypeError:
        raise ImproperlyConfigured("%s is not callable" % (klass.__name__))
Ejemplo n.º 5
0
 def test_get_module(self):
     module = load_class_from_path("throttle.tests.backends.TestThrottleBackend")
     self.assertEqual(module.__name__, 'TestThrottleBackend')
Ejemplo n.º 6
0
 def test_get_module(self):
     module = load_class_from_path(
         "throttle.tests.backends.TestThrottleBackend")
     self.assertEqual(module.__name__, 'TestThrottleBackend')
def _load_zone(zone_name, **config):
    vary_klass = load_class_from_path(config['VARY'])
    return ThrottleZone(zone_name, vary_klass, **config)