# Path: pygopherd/initialization.py
# def initconffile(conffile):
# def initlogger(config, conffile):
# def initexceptions(config):
# def initmimetypes(config):
#     def handle(self):
# def getserverobject(config):
#         def server_bind(self):
# def initsecurity(config):
# def initconditionaldetach(config):
# def initpidfile(config):
# def initpgrp(config):
# def initsighandlers(config, pgrp):
# def initeverything(conffile):
# class GopherRequestHandler(socketserver.StreamRequestHandler):
#     class MyServer(servertype):
# 
# Path: pygopherd/logger.py
# def log_file(message):
# def setlogfile(file):
# def log_syslog(message):
# def log_none(message):
# def init(config):
# 
# Path: pygopherd/fileext.py
# def extcmp(x, y):
# def extstrip(file, filetype):
# def init():


import unittest, socketserver, mimetypes
from pygopherd import initialization
from pygopherd import logger, fileext
#    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
# END OF COPYRIGHT #




class initializationConfigTestCase(unittest.TestCase):
    def testinitconffile(self):
        self.assertRaises(Exception, initialization.initconffile,
                          '/foo')
        # Load the standard config file.  It should be OK at least.
        config = initialization.initconffile('conf/pygopherd.conf')
        assert not config.has_option("pygopherd", "servername"), \
               "servername should be disabled by default"
        self.assertEqual(config.getint("pygopherd", "port"), 70,
               "Port should be 70")
        self.assertEqual(config.get("pygopherd", "servertype"),
                         "ForkingTCPServer",
                         "Servertype should be ForkingTCPServer")
        assert config.getboolean("pygopherd", "tracebacks"), \
               "Tracebacks should be enabled."

class initializationGeneralTestCase(unittest.TestCase):
    def setUp(self):

# Path: pygopherd/initialization.py
# def initconffile(conffile):
# def initlogger(config, conffile):
# def initexceptions(config):
# def initmimetypes(config):
#     def handle(self):
# def getserverobject(config):
#         def server_bind(self):
# def initsecurity(config):
# def initconditionaldetach(config):
# def initpidfile(config):
# def initpgrp(config):
# def initsighandlers(config, pgrp):
# def initeverything(conffile):
# class GopherRequestHandler(socketserver.StreamRequestHandler):
#     class MyServer(servertype):
# 
# Path: pygopherd/logger.py
# def log_file(message):
# def setlogfile(file):
# def log_syslog(message):
# def log_none(message):
# def init(config):
# 
# Path: pygopherd/fileext.py
# def extcmp(x, y):
# def extstrip(file, filetype):
# def init():


# Path: pygopherd/initializationTest.py
import unittest, socketserver, mimetypes
from pygopherd import initialization
from pygopherd import logger, fileext

#    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
# END OF COPYRIGHT #




class initializationConfigTestCase(unittest.TestCase):
    def testinitconffile(self):
        self.assertRaises(Exception, initialization.initconffile,
                          '/foo')
        # Load the standard config file.  It should be OK at least.
        config = initialization.initconffile('conf/pygopherd.conf')
        assert not config.has_option("pygopherd", "servername"), \
               "servername should be disabled by default"
        self.assertEqual(config.getint("pygopherd", "port"), 70,
               "Port should be 70")
        self.assertEqual(config.get("pygopherd", "servertype"),
                         "ForkingTCPServer",
                         "Servertype should be ForkingTCPServer")
        assert config.getboolean("pygopherd", "tracebacks"), \
               "Tracebacks should be enabled."

class initializationGeneralTestCase(unittest.TestCase):
    def setUp(self):

        self.config = initialization.initconffile('conf/pygopherd.conf')