Пример #1
0
    def setUp(self):
        """Create our FileConfig object and test it """
        # Reference a few configuration files here so that throughout
        # our tests we can easily use them.
        self.configFile = '%s/test_data/config.ini' % utils.getRootPath()
        self.template_path = '%s/test_data/templates' % utils.getRootPath()

        # Create our FileConfig object for testing
        self.config = file.FileConfig(self.configFile)
Пример #2
0
 def get_app(self):
     # Generate a real application server based on our test config data
     cfg = runserver.getConfigObject(
         'hooky.config.file.FileConfig',
         '%s/test_data/config.ini' % utils.getRootPath())
     server = app.getApplication(cfg)
     return server
Пример #3
0
    def testGetConfigObject(self):
        """Test the getConfigObject() method"""
        cfg_class = 'config.file.FileConfig'
        cfg_file = '%s/test_data/config.ini' % utils.getRootPath()

        cfg_object = runserver.getConfigObject(cfg_class, cfg_file)
        self.assertTrue(isinstance(cfg_object, file.FileConfig))
Пример #4
0
    def get_app(self):
        cfg_class = 'config.file.FileConfig'
        cfg_file = '%s/test_data/config.ini' % utils.getRootPath()
        config = runserver.getConfigObject(cfg_class, cfg_file)

        URLS = [
            ('/hook', hook.HookRootHandler, {'config': config}),
            (r"/hook/(.*)", hook.HookHandler, {'config': config})]

        return web.Application(URLS)
Пример #5
0
 def testGetGeneralMissingSection(self):
     """Test that a missing [general] section is OK"""
     tmp_config = file.FileConfig('%s/test_data/config_missing_general.ini'
                                  % utils.getRootPath())
     self.assertEquals({}, tmp_config.getGeneral())
Пример #6
0
 def setUp(self):
     """Creates a PostTranslator object and mocks appropriate calls"""
     self.io_loop = self.get_new_ioloop()
     self.source_path = '%s/test_data/sources' % utils.getRootPath()
Пример #7
0
 def setUp(self):
     """Creates a PostTranslator object and mocks appropriate calls"""
     self.translator = web.PostTranslator(URL, CONTENT_TYPE,
                                          TEMPLATE, AUTH, AUTH_MODE)
     self.io_loop = self.get_new_ioloop()
     self.source_path = '%s/test_data/sources' % utils.getRootPath()
Пример #8
0
 def setUp(self):
     """Creates a PostTranslator object"""
     self.translator = base.BaseTranslator()
     self.source_path = '%s/test_data/sources' % utils.getRootPath()
Пример #9
0
 def testGetRootPath(self):
     """Test the getRootPath() method"""
     path = utils.getRootPath()
     self.assertTrue(os.path.exists(path))
     self.assertTrue(os.path.exists('%s/test' % path))