Add mainly disfunctional test
Due to utter negligence test results are currently: 221 tests, 186 failures
This commit is contained in:
86
test/outlook_web/controllers/autor_controller_test.exs
Normal file
86
test/outlook_web/controllers/autor_controller_test.exs
Normal file
@ -0,0 +1,86 @@
|
||||
defmodule OutlookWeb.AutorControllerTest do
|
||||
use OutlookWeb.ConnCase
|
||||
|
||||
# TODO: make this work
|
||||
|
||||
import Outlook.PublicFixtures
|
||||
|
||||
@create_attrs %{description: "some description", homepage_name: "some homepage_name", homepage_url: "some homepage_url", name: "some name"}
|
||||
@update_attrs %{description: "some updated description", homepage_name: "some updated homepage_name", homepage_url: "some updated homepage_url", name: "some updated name"}
|
||||
@invalid_attrs %{description: nil, homepage_name: nil, homepage_url: nil, name: nil}
|
||||
|
||||
describe "index" do
|
||||
test "lists all autoren", %{conn: conn} do
|
||||
conn = get(conn, ~p"/autoren")
|
||||
assert html_response(conn, 200) =~ "Listing Autoren"
|
||||
end
|
||||
end
|
||||
|
||||
describe "new autor" do
|
||||
test "renders form", %{conn: conn} do
|
||||
conn = get(conn, ~p"/autoren/new")
|
||||
assert html_response(conn, 200) =~ "New Autor"
|
||||
end
|
||||
end
|
||||
|
||||
describe "create autor" do
|
||||
test "redirects to show when data is valid", %{conn: conn} do
|
||||
conn = post(conn, ~p"/autoren", autor: @create_attrs)
|
||||
|
||||
assert %{id: id} = redirected_params(conn)
|
||||
assert redirected_to(conn) == ~p"/autoren/#{id}"
|
||||
|
||||
conn = get(conn, ~p"/autoren/#{id}")
|
||||
assert html_response(conn, 200) =~ "Autor #{id}"
|
||||
end
|
||||
|
||||
test "renders errors when data is invalid", %{conn: conn} do
|
||||
conn = post(conn, ~p"/autoren", autor: @invalid_attrs)
|
||||
assert html_response(conn, 200) =~ "New Autor"
|
||||
end
|
||||
end
|
||||
|
||||
describe "edit autor" do
|
||||
setup [:create_autor]
|
||||
|
||||
test "renders form for editing chosen autor", %{conn: conn, autor: autor} do
|
||||
conn = get(conn, ~p"/autoren/#{autor}/edit")
|
||||
assert html_response(conn, 200) =~ "Edit Autor"
|
||||
end
|
||||
end
|
||||
|
||||
describe "update autor" do
|
||||
setup [:create_autor]
|
||||
|
||||
test "redirects when data is valid", %{conn: conn, autor: autor} do
|
||||
conn = put(conn, ~p"/autoren/#{autor}", autor: @update_attrs)
|
||||
assert redirected_to(conn) == ~p"/autoren/#{autor}"
|
||||
|
||||
conn = get(conn, ~p"/autoren/#{autor}")
|
||||
assert html_response(conn, 200) =~ "some updated description"
|
||||
end
|
||||
|
||||
test "renders errors when data is invalid", %{conn: conn, autor: autor} do
|
||||
conn = put(conn, ~p"/autoren/#{autor}", autor: @invalid_attrs)
|
||||
assert html_response(conn, 200) =~ "Edit Autor"
|
||||
end
|
||||
end
|
||||
|
||||
describe "delete autor" do
|
||||
setup [:create_autor]
|
||||
|
||||
test "deletes chosen autor", %{conn: conn, autor: autor} do
|
||||
conn = delete(conn, ~p"/autoren/#{autor}")
|
||||
assert redirected_to(conn) == ~p"/autoren"
|
||||
|
||||
assert_error_sent 404, fn ->
|
||||
get(conn, ~p"/autoren/#{autor}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
defp create_autor(_) do
|
||||
autor = autor_fixture()
|
||||
%{autor: autor}
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user