コード例 #1
0
ファイル: test_factory.py プロジェクト: githufsb/markwiki
 def test_storage_initializes(self):
     config = {'STORAGE_TYPE': 'file'}
     types = {'file': FakeUserStorage}
     factory = UserStorageFactory(storage_types=types)
     storage = factory.get_storage(config)
     self.assertTrue(isinstance(storage, FileUserStorage))
     self.assertTrue(storage.initialized)
コード例 #2
0
ファイル: test_factory.py プロジェクト: pyuro/markwiki
 def test_storage_initializes(self):
     config = {'STORAGE_TYPE': 'file'}
     types = {'file': FakeUserStorage}
     factory = UserStorageFactory(storage_types=types)
     storage = factory.get_storage(config)
     self.assertTrue(isinstance(storage, FileUserStorage))
     self.assertTrue(storage.initialized)
コード例 #3
0
ファイル: test_factory.py プロジェクト: pyuro/markwiki
class TestUserStorageFactory(unittest.TestCase):

    def setUp(self):
        self.factory = UserStorageFactory()

    def test_get_storage(self):
        config = {
            'MARKWIKI_HOME': 'nothing',
            'STORAGE_TYPE': 'file'
        }

        storage = self.factory._get_storage(config)
        self.assertTrue(isinstance(storage, FileUserStorage))

    def test_invalid_storage(self):
        config = {}
        self.assertRaises(ConfigurationError, self.factory.get_storage, config)

    def test_storage_initializes(self):
        config = {'STORAGE_TYPE': 'file'}
        types = {'file': FakeUserStorage}
        factory = UserStorageFactory(storage_types=types)
        storage = factory.get_storage(config)
        self.assertTrue(isinstance(storage, FileUserStorage))
        self.assertTrue(storage.initialized)
コード例 #4
0
ファイル: test_factory.py プロジェクト: githufsb/markwiki
class TestUserStorageFactory(unittest.TestCase):

    def setUp(self):
        self.factory = UserStorageFactory()

    def test_get_storage(self):
        config = {
            'MARKWIKI_HOME': 'nothing',
            'STORAGE_TYPE': 'file'
        }

        storage = self.factory._get_storage(config)
        self.assertTrue(isinstance(storage, FileUserStorage))

    def test_invalid_storage(self):
        config = {}
        self.assertRaises(ConfigurationError, self.factory.get_storage, config)

    def test_storage_initializes(self):
        config = {'STORAGE_TYPE': 'file'}
        types = {'file': FakeUserStorage}
        factory = UserStorageFactory(storage_types=types)
        storage = factory.get_storage(config)
        self.assertTrue(isinstance(storage, FileUserStorage))
        self.assertTrue(storage.initialized)
コード例 #5
0
ファイル: application.py プロジェクト: deadc0de6/markwiki
def build_app(app_name):
    '''Build the application and extend it with various services.'''
    app = MarkWikiApp(app_name)

    if not app.is_bootstrapped():
        print('This appears to be a new MarkWiki. Adding initial content ...')
        util.bootstrap(app)

    # Extend the app with the search engine.
    app.search_engine = SearchEngine(app.config['MARKWIKI_HOME'])
    if not app.search_engine.has_index():
        app.search_engine.create_index(app.config['WIKI_PATH'])

    user_storage_factory = UserStorageFactory()
    app.user_storage = user_storage_factory.get_storage(app.config)

    return app
コード例 #6
0
def build_app(app_name):
    '''Build the application and extend it with various services.'''
    app = MarkWikiApp(app_name)

    if not app.is_bootstrapped():
        print('This appears to be a new MarkWiki. Adding initial content ...')
        util.bootstrap(app)

    # Extend the app with the search engine.
    app.search_engine = SearchEngine(app.config['MARKWIKI_HOME'])
    if not app.search_engine.has_index():
        app.search_engine.create_index(app.config['WIKI_PATH'])

    user_storage_factory = UserStorageFactory()
    app.user_storage = user_storage_factory.get_storage(app.config)

    return app
コード例 #7
0
ファイル: test_factory.py プロジェクト: pyuro/markwiki
 def setUp(self):
     self.factory = UserStorageFactory()
コード例 #8
0
ファイル: test_factory.py プロジェクト: githufsb/markwiki
 def setUp(self):
     self.factory = UserStorageFactory()