Fix DBIServer FormComponent to allow edit only other servers' sync_on?.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
+27
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user