Create write-protected file on the fly in tests

This commit is contained in:
Jonatan Kłosko 2021-04-14 16:47:50 +02:00
parent 83b94c6b0b
commit cf35a46ecf
2 changed files with 6 additions and 3 deletions

View file

@ -78,10 +78,14 @@ defmodule LivebookWeb.HomeLiveTest do
|> has_element?()
end
test "disables open when a write-protected notebook is selected", %{conn: conn} do
@tag :tmp_dir
test "disables open when a write-protected notebook is selected",
%{conn: conn, tmp_dir: tmp_dir} do
{:ok, view, _} = live(conn, "/")
path = test_notebook_path("write_protected")
path = Path.join(tmp_dir, "write_protected.livemd")
File.touch!(path)
File.chmod!(path, 0o444)
view
|> element("form")

View file

@ -1 +0,0 @@
# Write-protected notebook