[Enhancement] Adds in-app diagnostics page (#243)
* Added improved sidebar menuing * Added new view for getting diagnostic data * Changed default log level to debug * Disabled false-positive static analysis
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
defmodule PinchflatWeb.SettingControllerTest do
|
||||
use PinchflatWeb.ConnCase
|
||||
|
||||
alias Pinchflat.Utils.FilesystemUtils
|
||||
|
||||
describe "show settings" do
|
||||
test "renders the page", %{conn: conn} do
|
||||
conn = get(conn, ~p"/settings")
|
||||
@@ -20,4 +22,33 @@ defmodule PinchflatWeb.SettingControllerTest do
|
||||
assert html_response(conn, 200) =~ update_attrs[:apprise_server]
|
||||
end
|
||||
end
|
||||
|
||||
describe "app_info" do
|
||||
test "renders the page", %{conn: conn} do
|
||||
conn = get(conn, ~p"/app_info")
|
||||
|
||||
assert html_response(conn, 200) =~ "App Info"
|
||||
end
|
||||
end
|
||||
|
||||
describe "download_logs" do
|
||||
test "downloads logs", %{conn: conn} do
|
||||
log_path = Path.join([System.tmp_dir!(), "pinchflat", "data", "pinchflat.log"])
|
||||
FilesystemUtils.write_p(log_path, "test log data")
|
||||
Application.put_env(:pinchflat, :log_path, log_path)
|
||||
|
||||
conn = get(conn, ~p"/download_logs")
|
||||
|
||||
assert response(conn, 200) =~ "test log data"
|
||||
|
||||
Application.put_env(:pinchflat, :log_path, nil)
|
||||
end
|
||||
|
||||
test "redirects when log file is not found", %{conn: conn} do
|
||||
conn = get(conn, ~p"/download_logs")
|
||||
|
||||
assert redirected_to(conn) == ~p"/app_info"
|
||||
assert conn.assigns[:flash]["error"] == "Log file couldn't be found"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user