mirror of
https://github.com/akuker/RASCSI.git
synced 2025-01-10 17:30: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"])
|
@APP.route("/drive/list", methods=["GET"])
|
||||||
def drive_list():
|
def drive_list():
|
||||||
"""
|
"""
|
||||||
@ -325,7 +333,7 @@ def login():
|
|||||||
if AUTH_GROUP in groups:
|
if AUTH_GROUP in groups:
|
||||||
if authenticate(str(username), str(password)):
|
if authenticate(str(username), str(password)):
|
||||||
session["username"] = request.form["username"]
|
session["username"] = request.form["username"]
|
||||||
return response()
|
return response(env=get_env_info())
|
||||||
|
|
||||||
return response(error=True, status_code=401, message=_(
|
return response(error=True, status_code=401, message=_(
|
||||||
"You must log in with valid credentials for a user in the '%(group)s' group",
|
"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.status_code == 200
|
||||||
assert response_data["status"] == STATUS_SUCCESS
|
assert response_data["status"] == STATUS_SUCCESS
|
||||||
|
assert "env" in response_data["data"]
|
||||||
|
|
||||||
|
|
||||||
# route("/login", methods=["POST"])
|
# route("/login", methods=["POST"])
|
||||||
@ -737,6 +738,16 @@ def test_index(http_client):
|
|||||||
assert "devices" in response_data["data"]
|
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>")
|
# route("/pwa/<path:pwa_path>")
|
||||||
def test_pwa_route(http_client):
|
def test_pwa_route(http_client):
|
||||||
response = http_client.get("/pwa/favicon.ico")
|
response = http_client.get("/pwa/favicon.ico")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user