def use_test_config(request): Environment.reset() Environment.config = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "test_conf") Environment.noargs = True env = Environment.getInstance() if has_dbus: # Enable DBus runner dr = DBusRunner() dr.start() PluginRegistry(component='gosa.client.module') # @UnusedVariable env.active = True def shutdown(): env.active = False # Wait for threads to shut down for t in env.threads: if hasattr(t, 'stop'): t.stop() if hasattr(t, 'cancel'): t.cancel() t.join(2) PluginRegistry.shutdown() if has_dbus: dr.stop() request.addfinalizer(shutdown)
def use_test_config(): Environment.reset() Environment.config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "..", "test_conf") Environment.noargs = True oreg = ObjectRegistry.getInstance() # @UnusedVariable pr = PluginRegistry() # @UnusedVariable cr = PluginRegistry.getInstance("CommandRegistry") # @UnusedVariable
def use_test_config(): Environment.reset() Environment.config = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "..", "test_conf") Environment.noargs = True oreg = ObjectRegistry.getInstance() # @UnusedVariable pr = PluginRegistry() # @UnusedVariable cr = PluginRegistry.getInstance("CommandRegistry") # @UnusedVariable
def use_test_config(): Environment.reset() if pytest.config.getoption("--travis"): Environment.config = os.path.join( os.path.dirname(os.path.realpath(__file__)), "configs", "travis_conf") else: Environment.config = os.path.join( os.path.dirname(os.path.realpath(__file__)), "configs", "test_conf") Environment.noargs = True
import os import unittest from gosa.common import Environment from gosa.agent.plugins.goto.network import NetworkUtils Environment.reset() Environment.config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test.conf") Environment.noargs = True class TestGOtoPlugin(unittest.TestCase): def test_mksmbhash(self): #TODO: mockup env network = NetworkUtils() #networkCompletion #getMacManufacturer #self.assertEqual(sambaUtils.mksmbhash('secret'), '552902031BEDE9EFAAD3B435B51404EE:878D8014606CDA29677A44EFA1353FC7') #self.assertEqual(sambaUtils.mksmbhash(''), 'AAD3B435B51404EEAAD3B435B51404EE:31D6CFE0D16AE931B73C59D7E0C089C0') #self.assertRaises(TypeError, sambaUtils.mksmbhash, None, '') if __name__ == "__main__": unittest.main()
def use_test_config(): Environment.reset() Environment.config = os.path.join(os.path.dirname(os.path.realpath(__file__)), "test_conf") Environment.noargs = True