def testFromBoth(self): config = WebappConfiguration() sys.argv = 'maay --db-host truc'.split() config.config_file = osp.join(osp.dirname(__file__), 'data', 'webapp2.ini') config.load() self.assertEquals(config.db_host, 'truc') self.assertEquals(config.db_name, 'muche')
def testFromCommandLine(self): """For this test to not fail, the configuration file must define the database as being 'maay' """ data = [('maay', ('localhost', 'maay')), ('maay --db-name maille', ('localhost', 'maille')), ('maay --db-host foo', ('foo', 'maay')), ('maay --db-host foo --db-name maille', ('foo', 'maille')), ] for cmdLine, (expectedHost, expectedDatabase) in data: config = WebappConfiguration() sys.argv = cmdLine.split() config.load() self.assertEquals(config.db_host, expectedHost) self.assertEquals(config.db_name, expectedDatabase)
def setUp(self): portal = MaayPortal(WebappConfiguration()) portal.registerChecker(FakeChecker(portal.realm)) self.portal = portal rpcserver = server.Site(rpc.MaayRPCServer(None, portal)) self.p = reactor.listenTCP(0, rpcserver, interface="127.0.0.1") self.port = self.p.getHost().port
def test0FromConfigFile(self): config = WebappConfiguration() config.config_file = osp.join(osp.dirname(__file__), 'data', 'webapp1.ini') config.load() self.assertEquals(config.db_host, 'eusebius') self.assertEquals(config.db_name, 'maay')