From 8a2fb397b9bfc7d86d4da62f998eb9f1d2331c2a Mon Sep 17 00:00:00 2001 From: David Rousselie Date: Fri, 16 May 2008 19:04:09 +0200 Subject: Override uncomplete configuration file test darcs-hash:20080516170409-86b55-184a1a27f053546f4d77588168f0769f24992b3c.gz --- src/jmc/tests/runner.py | 25 ++++++++++++++++++------- src/jmc/tests/uncomplete_jmc.conf | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 7 deletions(-) create mode 100644 src/jmc/tests/uncomplete_jmc.conf diff --git a/src/jmc/tests/runner.py b/src/jmc/tests/runner.py index 9ed0a80..eb42cdc 100644 --- a/src/jmc/tests/runner.py +++ b/src/jmc/tests/runner.py @@ -3,18 +3,18 @@ ## Login : David Rousselie ## Started on Fri May 18 13:43:37 2007 David Rousselie ## $Id$ -## +## ## Copyright (C) 2007 David Rousselie ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or ## (at your option) any later version. -## +## ## This program is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. -## +## ## You should have received a copy of the GNU General Public License ## along with this program; if not, write to the Free Software ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA @@ -46,7 +46,7 @@ class JMCRunner_TestCase(JCLRunner_TestCase): def tearDown(self): self.runner = None sys.argv = [""] - + def test_configure_default(self): self.runner.configure() self.assertEquals(self.runner.config_file, "jmc.conf") @@ -75,6 +75,18 @@ class JMCRunner_TestCase(JCLRunner_TestCase): self.assertEquals(self.runner.mail_default_encoding, "test_iso-8859-1") self.assertEquals(self.runner.check_interval, 2) + def test_configure_uncomplete_configfile(self): + self.runner.config_file = "src/jmc/tests/uncomplete_jmc.conf" + self.runner.configure() + self.assertEquals(self.runner.server, "test_localhost") + self.assertEquals(self.runner.port, 42) + self.assertEquals(self.runner.secret, "test_secret") + self.assertEquals(self.runner.service_jid, "test_jmc.localhost") + self.assertEquals(self.runner.language, "test_en") + self.assertEquals(self.runner.db_url, "test_sqlite://root@localhost/var/spool/jabber/test_jmc.db") + self.assertEquals(self.runner.pid_file, "/var/run/jabber/test_jmc.pid") + self.assertFalse(self.runner.debug) + def test_configure_commandline_shortopt(self): sys.argv = ["", "-c", "src/jmc/tests/jmc.conf", \ "-S", "test2_localhost", \ @@ -120,7 +132,7 @@ class JMCRunner_TestCase(JCLRunner_TestCase): self.assertFalse(self.runner.debug) self.assertEquals(self.runner.mail_default_encoding, "test2_iso-8859-1") self.assertEquals(self.runner.check_interval, 4) - + def test__run(self): self.runner.pid_file = "/tmp/jmc.pid" self.runner.db_url = DB_URL @@ -141,7 +153,7 @@ class JMCRunner_TestCase(JCLRunner_TestCase): model.db_disconnect() os.unlink(DB_PATH) self.assertFalse(os.access("/tmp/jmc.pid", os.F_OK)) - + def suite(): test_suite = unittest.TestSuite() test_suite.addTest(unittest.makeSuite(JMCRunner_TestCase, 'test')) @@ -149,4 +161,3 @@ def suite(): if __name__ == '__main__': unittest.main(defaultTest='suite') - diff --git a/src/jmc/tests/uncomplete_jmc.conf b/src/jmc/tests/uncomplete_jmc.conf new file mode 100644 index 0000000..02ab0e9 --- /dev/null +++ b/src/jmc/tests/uncomplete_jmc.conf @@ -0,0 +1,24 @@ +[jabber] +server: test_localhost +port: 42 +secret: test_secret +service_jid: test_jmc.localhost +#supported language: en, fr (See src/jmc/lang.py to add more) +language: test_en + +[db] +#type: mysql +type: test_sqlite +#host: root@localhost +host: root@localhost +name: /var/spool/jabber/test_jmc.db +#url: %(type)%(host)%(name)?debug=1&debugThreading=1 +db_url: %(type)s://%(host)s%(name)s + +[component] +pid_file: /var/run/jabber/test_jmc.pid +log_file: /tmp/jmc.log + +[jmc] +mail_default_encoding: test_iso-8859-1 +check_interval: 2 -- cgit v1.2.3