Example #1
0
def agent_logs(amount):
    static = get_static()
    if not os.path.isfile(static.main_log):
        return jsonify(messages=[])

    lines = tail('-n {}'.format(amount), static.main_log).splitlines()
    return jsonify(messages=lines)
Example #2
0
def _validate_login(username, password):
    s = get_static()
    return s.user == username and check_password_hash(s.password, password)
Example #3
0
def test_loaded_anew_in_each_context(app):
    with app.app_context():
        s = get_static()

    with app.app_context():
        assert s is not get_static()
Example #4
0
def test_get_static_data(app, username, password):
    with app.app_context():
        s = get_static()
        assert check_password_hash(s.password, password) and s.user == username
Example #5
0
def test_static_data_is_cashed(app):
    with app.app_context():
        assert get_static() is get_static()