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/artikel_controller_test.exs
Normal file
86
test/outlook_web/controllers/artikel_controller_test.exs
Normal file
@ -0,0 +1,86 @@
|
||||
defmodule OutlookWeb.ArtikelControllerTest do
|
||||
use OutlookWeb.ConnCase
|
||||
|
||||
# TODO: make this work
|
||||
|
||||
import Outlook.PublicFixtures
|
||||
|
||||
@create_attrs %{date: "some date", public_content: "some public_content", teaser: "some teaser", title: "some title", translator: "some translator", unauthorized: true}
|
||||
@update_attrs %{date: "some updated date", public_content: "some updated public_content", teaser: "some updated teaser", title: "some updated title", translator: "some updated translator", unauthorized: false}
|
||||
@invalid_attrs %{date: nil, public_content: nil, teaser: nil, title: nil, translator: nil, unauthorized: nil}
|
||||
|
||||
describe "index" do
|
||||
test "lists all artikel", %{conn: conn} do
|
||||
conn = get(conn, ~p"/artikel")
|
||||
assert html_response(conn, 200) =~ "Listing Artikel"
|
||||
end
|
||||
end
|
||||
|
||||
describe "new artikel" do
|
||||
test "renders form", %{conn: conn} do
|
||||
conn = get(conn, ~p"/artikel/new")
|
||||
assert html_response(conn, 200) =~ "New Artikel"
|
||||
end
|
||||
end
|
||||
|
||||
describe "create artikel" do
|
||||
test "redirects to show when data is valid", %{conn: conn} do
|
||||
conn = post(conn, ~p"/artikel", artikel: @create_attrs)
|
||||
|
||||
assert %{id: id} = redirected_params(conn)
|
||||
assert redirected_to(conn) == ~p"/artikel/#{id}"
|
||||
|
||||
conn = get(conn, ~p"/artikel/#{id}")
|
||||
assert html_response(conn, 200) =~ "Artikel #{id}"
|
||||
end
|
||||
|
||||
test "renders errors when data is invalid", %{conn: conn} do
|
||||
conn = post(conn, ~p"/artikel", artikel: @invalid_attrs)
|
||||
assert html_response(conn, 200) =~ "New Artikel"
|
||||
end
|
||||
end
|
||||
|
||||
describe "edit artikel" do
|
||||
setup [:create_artikel]
|
||||
|
||||
test "renders form for editing chosen artikel", %{conn: conn, artikel: artikel} do
|
||||
conn = get(conn, ~p"/artikel/#{artikel}/edit")
|
||||
assert html_response(conn, 200) =~ "Edit Artikel"
|
||||
end
|
||||
end
|
||||
|
||||
describe "update artikel" do
|
||||
setup [:create_artikel]
|
||||
|
||||
test "redirects when data is valid", %{conn: conn, artikel: artikel} do
|
||||
conn = put(conn, ~p"/artikel/#{artikel}", artikel: @update_attrs)
|
||||
assert redirected_to(conn) == ~p"/artikel/#{artikel}"
|
||||
|
||||
conn = get(conn, ~p"/artikel/#{artikel}")
|
||||
assert html_response(conn, 200) =~ "some updated date"
|
||||
end
|
||||
|
||||
test "renders errors when data is invalid", %{conn: conn, artikel: artikel} do
|
||||
conn = put(conn, ~p"/artikel/#{artikel}", artikel: @invalid_attrs)
|
||||
assert html_response(conn, 200) =~ "Edit Artikel"
|
||||
end
|
||||
end
|
||||
|
||||
describe "delete artikel" do
|
||||
setup [:create_artikel]
|
||||
|
||||
test "deletes chosen artikel", %{conn: conn, artikel: artikel} do
|
||||
conn = delete(conn, ~p"/artikel/#{artikel}")
|
||||
assert redirected_to(conn) == ~p"/artikel"
|
||||
|
||||
assert_error_sent 404, fn ->
|
||||
get(conn, ~p"/artikel/#{artikel}")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
defp create_artikel(_) do
|
||||
artikel = artikel_fixture()
|
||||
%{artikel: artikel}
|
||||
end
|
||||
end
|
||||
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