Exemplo n.º 1
0
    def testRegisterInvalidNamespace(self):
        try:
            rm.registerNamespace("I.HEART.DOTS", rm.SimpleResourceFactory())
        except ValueError:
            return

        self.fail("Managed to register an invalid namespace")
Exemplo n.º 2
0
 def setUp(self):
     manager = self.manager = resourceManager.ResourceManager.getInstance()
     manager.registerNamespace("storage",
                               resourceManager.SimpleResourceFactory())
     manager.registerNamespace("null", NullResourceFactory())
     manager.registerNamespace("string", StringResourceFactory())
     manager.registerNamespace("error", ErrorResourceFactory())
     manager.registerNamespace("switchfail", SwitchFailFactory())
     manager.registerNamespace("crashy", CrashOnCloseFactory())
     manager.registerNamespace("failAfterSwitch", FailAfterSwitchFactory())
Exemplo n.º 3
0
def manager():
    """
    Create fresh _ResourceManager instance for testing.
    """
    manager = rm._ResourceManager()
    manager.registerNamespace("storage", rm.SimpleResourceFactory())
    manager.registerNamespace("null", NullResourceFactory())
    manager.registerNamespace("string", StringResourceFactory())
    manager.registerNamespace("error", ErrorResourceFactory())
    manager.registerNamespace("switchfail", SwitchFailFactory())
    manager.registerNamespace("crashy", CrashOnCloseFactory())
    manager.registerNamespace("failAfterSwitch", FailAfterSwitchFactory())
    return manager
Exemplo n.º 4
0
 def testForceRegisterNamespace(self):
     manager = self.manager
     manager.registerNamespace("storage",
                               resourceManager.SimpleResourceFactory(),
                               True)
Exemplo n.º 5
0
 def testReregisterNamespace(self):
     manager = self.manager
     self.assertRaises((ValueError, KeyError), manager.registerNamespace,
                       "storage", resourceManager.SimpleResourceFactory())
Exemplo n.º 6
0
 def testForceRegisterNamespace(self):
     rm.registerNamespace("storage", rm.SimpleResourceFactory(), True)
Exemplo n.º 7
0
 def testReregisterNamespace(self):
     self.assertRaises((ValueError, KeyError), rm.registerNamespace,
                       "storage", rm.SimpleResourceFactory())