Example #1
0
# app.config['AUTHENTICATION_METHOD'] = options.authentication_method
app.config['AUTHENTICATION_METHOD'] = 'cleartext'
app.config['SEARCH_IGNORE_CASE'] = True

try:
    app.config.from_pyfile(
        os.path.join(app.config.get('CONTENT_DIR'), 'config.py'))
except IOError:
    print("Startup Failure: You need to place a "
          "config.py in your content directory.")

wiki = Wiki(app.config.get('CONTENT_DIR'))
users = UserManager(app.config.get('CONTENT_DIR'))

users.add_user('admin',
               'dev',
               authentication_method=app.config.get('AUTHENTICATION_METHOD'))

loginmanager = LoginManager()
loginmanager.init_app(app)
loginmanager.login_view = 'user_login'
"""
    Forms
    ~~~~~
"""


# https://stackoverflow.com/questions/13585663/flask-wtfform-flash-does-not-display-errors
def flash_errors(form):
    for field, errors in form.errors.items():
        for error in errors:
Example #2
0
 def test_add_users(self):
     user_manager = UserManager()
     self.assertEqual('test',
                      user_manager.add_user('test', 'password').get('name'))