Fix DBIServer FormComponent to allow edit only other servers' sync_on?.
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-05-20 22:13:10 +03:00
parent ffbec934a6
commit db025ece6a
2 changed files with 28 additions and 1 deletions
@@ -87,5 +87,32 @@ defmodule DecentralisedBookIndexWeb.LiveViewsPermissionsForOtherServersDataTest
|> live("/servers/#{dbi_server.id}/edit")
end
end
test "can edit this server data", %{conn: conn, admin: admin} do
dbi_server = generate(dbi_server())
for user <- [admin] do
assert {:ok, view, _html} =
conn
|> log_in_user(user)
|> live("/servers/#{dbi_server.id}/edit")
assert has_element?(view, "input#dbi_server_name")
assert has_element?(view, "input#dbi_server_url")
end
end
test "can edit other servers' data, but only sync_on?", %{conn: conn, admin: admin, dbi_server: dbi_server} do
for user <- [admin] do
assert {:ok, view, _html} =
conn
|> log_in_user(user)
|> live("/servers/#{dbi_server.id}/edit")
refute has_element?(view, "input#dbi_server_name")
refute has_element?(view, "input#dbi_server_url")
end
end
end
end