mirror of https://gitlab.com/openlp/openlp.git
Add web API endpoint get configured language
This commit is contained in:
parent
f2484d170a
commit
fd45bba951
|
@ -24,6 +24,7 @@ from flask import jsonify, request, abort, Blueprint
|
||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from openlp.core.api.lib import login_required
|
from openlp.core.api.lib import login_required
|
||||||
|
from openlp.core.common.i18n import LanguageManager
|
||||||
from openlp.core.common.registry import Registry
|
from openlp.core.common.registry import Registry
|
||||||
from openlp.core.lib.plugin import PluginStatus, StringContent
|
from openlp.core.lib.plugin import PluginStatus, StringContent
|
||||||
from openlp.core.state import State
|
from openlp.core.state import State
|
||||||
|
@ -82,6 +83,12 @@ def system_information():
|
||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
|
|
||||||
|
|
||||||
|
@core.route('/language')
|
||||||
|
def language():
|
||||||
|
language = LanguageManager.get_language()
|
||||||
|
return jsonify({'language': language})
|
||||||
|
|
||||||
|
|
||||||
@core.route('/login', methods=['POST'])
|
@core.route('/login', methods=['POST'])
|
||||||
def login():
|
def login():
|
||||||
data = request.json
|
data = request.json
|
||||||
|
|
|
@ -69,6 +69,12 @@ def test_shortcuts(flask_client: FlaskClient, settings: Settings):
|
||||||
assert res.get_json()[0]['shortcut'] == shortcut
|
assert res.get_json()[0]['shortcut'] == shortcut
|
||||||
|
|
||||||
|
|
||||||
|
def test_language(flask_client: FlaskClient, settings: Settings):
|
||||||
|
res = flask_client.get('/api/v2/core/language')
|
||||||
|
assert res.status_code == 200
|
||||||
|
assert res.get_json()['language']
|
||||||
|
|
||||||
|
|
||||||
def test_poll_backend(settings: Settings):
|
def test_poll_backend(settings: Settings):
|
||||||
"""
|
"""
|
||||||
Test the raw poll function returns the correct JSON
|
Test the raw poll function returns the correct JSON
|
||||||
|
|
Loading…
Reference in New Issue