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)
def _validate_login(username, password): s = get_static() return s.user == username and check_password_hash(s.password, password)
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()
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
def test_static_data_is_cashed(app): with app.app_context(): assert get_static() is get_static()