From: Mariana Mărășoiu Date: Wed, 24 Aug 2011 18:15:03 +0000 (+0300) Subject: ppf/new: Add config.py. Add skeleton functions and tests for config.py. X-Git-Url: http://p2p-next.cs.pub.ro/gitweb/?a=commitdiff_plain;h=460bf70ea13cc64a2855c66ece08d49540f3b61d;p=cs-p2p-next.git ppf/new: Add config.py. Add skeleton functions and tests for config.py. --- diff --git a/ppf/new/config.py b/ppf/new/config.py new file mode 100644 index 0000000..98a30fe --- /dev/null +++ b/ppf/new/config.py @@ -0,0 +1,90 @@ +""" +Configuration class for P2P logging information. + +2011, Mariana Marasoiu, mariana.marasoiu@gmail.com +""" + +import os +import os.path +import logging + +# +# Logging code heavily inspired by Logging HOWTO documentation: +# http://docs.python.org/dev/howto/logging.html#configuring-logging +# + +# Create logger; default logging level is DEBUG. +logger = logging.getLogger(__name__) +logger.setLevel(logging.DEBUG) + +# Create console handler and set level to ERROR. +ch = logging.StreamHandler() +ch.setLevel(logging.DEBUG) + +# Create formatter. +formatter = logging.Formatter('%(filename)s:%(lineno)s - %(levelname)s: %(message)s') + +# Add formatter to console handler. +ch.setFormatter(formatter) + +# Add console handler to logger. +logger.addHandler(ch) + + +class SwarmConfig(object): + def __init__(self): + pass + + def load(self, ini_file): + pass + + def store(self, ini_file): + pass + + def add(self, section, option, value): + pass + + def get(self, section): + pass + + def set(self, section, option, value): + pass + +class SessionConfig(object): + def __init__(self): + pass + + def load(self, ini_file): + pass + + def store(self, ini_file): + pass + + def add(self, section, option, value): + pass + + def get(self, section): + pass + + def set(self, section, option, value): + pass + +class AccessConfig(object): + def __init__(self): + pass + + def load(self, ini_file): + pass + + def store(self, ini_file): + pass + + def add(self, section, option, value): + pass + + def get(self, section): + pass + + def set(self, section, option, value): + pass + diff --git a/ppf/new/tests/test_config.py b/ppf/new/tests/test_config.py new file mode 100644 index 0000000..bc30a78 --- /dev/null +++ b/ppf/new/tests/test_config.py @@ -0,0 +1,73 @@ +""" +Test suite for config. Uses unittest module. + +2011, Mariana Marasoiu, mariana.marasoiu@gmail.com +""" + +import unittest +import os +import os.path +import shutil +import sys + +import config + +class SwarmConfigTest(object): + """ + Test suite for SwarmConfig class in config.py. + """ + def setUp(self) + pass + + def tearDown(self) + pass + + def test_add(self): + pass + + def test_get(self): + pass + + def test_other(self): + pass + +class SessionConfigTest(object): + """ + Test suite for AccessConfig class in config.py. + """ + def setUp(self) + pass + + def tearDown(self) + pass + + def test_add(self): + pass + + def test_get(self): + pass + + def test_other(self): + pass + +class AccessConfigTest(object): + """ + Test suite for AccessConfig class in config.py. + """ + def setUp(self) + pass + + def tearDown(self) + pass + + def test_add(self): + pass + + def test_get(self): + pass + + def test_other(self): + pass + +if __name__ == "__main__": + unittest.main()