mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-30 05:29:47 +00:00
Expose env info to API clients
This commit is contained in:
parent
0e6147e0bb
commit
1a15c4c648
@ -260,6 +260,14 @@ def index():
|
||||
)
|
||||
|
||||
|
||||
@APP.route("/env")
|
||||
def env():
|
||||
"""
|
||||
Shows information about the app/host environment
|
||||
"""
|
||||
return response(**get_env_info())
|
||||
|
||||
|
||||
@APP.route("/drive/list", methods=["GET"])
|
||||
def drive_list():
|
||||
"""
|
||||
@ -325,7 +333,7 @@ def login():
|
||||
if AUTH_GROUP in groups:
|
||||
if authenticate(str(username), str(password)):
|
||||
session["username"] = request.form["username"]
|
||||
return response()
|
||||
return response(env=get_env_info())
|
||||
|
||||
return response(error=True, status_code=401, message=_(
|
||||
"You must log in with valid credentials for a user in the '%(group)s' group",
|
||||
|
@ -98,6 +98,7 @@ def test_login_with_valid_credentials(pytestconfig, http_client_unauthenticated)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response_data["status"] == STATUS_SUCCESS
|
||||
assert "env" in response_data["data"]
|
||||
|
||||
|
||||
# route("/login", methods=["POST"])
|
||||
@ -737,6 +738,16 @@ def test_index(http_client):
|
||||
assert "devices" in response_data["data"]
|
||||
|
||||
|
||||
# route("/env")
|
||||
def test_get_env_info(http_client):
|
||||
response = http_client.get("/env")
|
||||
response_data = response.json()
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response_data["status"] == STATUS_SUCCESS
|
||||
assert "running_env" in response_data["data"]
|
||||
|
||||
|
||||
# route("/pwa/<path:pwa_path>")
|
||||
def test_pwa_route(http_client):
|
||||
response = http_client.get("/pwa/favicon.ico")
|
||||
|
Loading…
Reference in New Issue
Block a user