From 42e8fb3e128abcb98bddda6888a68e66a3ce9a32 Mon Sep 17 00:00:00 2001 From: handnot2 Date: Mon, 6 Nov 2017 07:36:49 -0800 Subject: [PATCH] formatter uptake --- .formatter.exs | 11 +++ config/config.exs | 5 +- config/dev.exs | 75 +++++++++++-------- lib/samly_howto/application.ex | 2 +- lib/samly_howto_web.ex | 5 +- lib/samly_howto_web/channels/user_socket.ex | 2 +- .../controllers/page_controller.ex | 20 +++-- lib/samly_howto_web/endpoint.ex | 8 +- lib/samly_howto_web/plugs/samly_pipeline.ex | 5 +- lib/samly_howto_web/router.ex | 7 +- lib/samly_howto_web/views/error_helpers.ex | 4 +- lib/samly_howto_web/views/error_view.ex | 2 +- mix.exs | 12 +-- mix.lock | 28 +++---- .../controllers/page_controller_test.exs | 2 +- .../samly_howto_web/views/error_view_test.exs | 9 +-- test/support/channel_case.ex | 2 - test/support/conn_case.ex | 2 - test/test_helper.exs | 1 - 19 files changed, 112 insertions(+), 90 deletions(-) create mode 100644 .formatter.exs diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..26cac54 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,11 @@ +[ + inputs: [ + "mix.exs", + "{config,lib,test}/**/*.{ex,exs}" + ], + + locals_without_parens: [ + plug: 1, + plug: 2 + ] +] diff --git a/config/config.exs b/config/config.exs index e39d0eb..6de5406 100644 --- a/config/config.exs +++ b/config/config.exs @@ -10,8 +10,7 @@ config :samly_howto, SamlyHowtoWeb.Endpoint, url: [host: "localhost"], secret_key_base: "xyC3UIJzAYfuGyQXTYCHeWiD90ziZBPuk07QQFWURvXTRDSFaurxcjcxFPwj1h2Z", render_errors: [view: SamlyHowtoWeb.ErrorView, accepts: ~w(html json)], - pubsub: [name: SamlyHowto.PubSub, - adapter: Phoenix.PubSub.PG2] + pubsub: [name: SamlyHowto.PubSub, adapter: Phoenix.PubSub.PG2] # Configures Elixir's Logger config :logger, :console, @@ -20,4 +19,4 @@ config :logger, :console, # Import environment specific config. This must remain at the bottom # of this file so it overrides the configuration defined above. -import_config "#{Mix.env}.exs" +import_config "#{Mix.env()}.exs" diff --git a/config/dev.exs b/config/dev.exs index 61ca62f..62621b6 100644 --- a/config/dev.exs +++ b/config/dev.exs @@ -12,8 +12,14 @@ config :samly_howto, SamlyHowtoWeb.Endpoint, debug_errors: true, code_reloader: true, check_origin: false, - watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin", - cd: Path.expand("../assets", __DIR__)]] + watchers: [ + node: [ + "node_modules/brunch/bin/brunch", + "watch", + "--stdin", + cd: Path.expand("../assets", __DIR__) + ] + ] # ## SSL Support # @@ -49,9 +55,12 @@ config :logger, :console, format: "[$level] $message\n" # in production as building large stacktraces may be expensive. config :phoenix, :stacktrace_depth, 20 +# #### Identity Provider ID choices +# +# IdP ID from `:path_segment` is used OOTB. +# Set this to `:subdomain` when sub-domain in the hostname is to be treated as IdP ID. config :samly, Samly.Provider, idp_id_from: :path_segment, - #idp_id_from: :subdomain, service_providers: [ %{ id: "sp1", @@ -68,23 +77,23 @@ config :samly, Samly.Provider, id: "sp2", entity_id: "urn:idp2.samly.howto:sp2", certfile: "samly.crt", - keyfile: "samly.pem", - #contact_name: "Samly Howto SP2 Admin", - #contact_email: "sp2-admin@samly.howto", - #org_name: "Samly Howto SP2", - #org_displayname: "Samly Howto SP2 Displayname", - #org_url: "http://idp2.samly.howto:4003" + keyfile: "samly.pem" + # contact_name: "Samly Howto SP2 Admin", + # contact_email: "sp2-admin@samly.howto", + # org_name: "Samly Howto SP2", + # org_displayname: "Samly Howto SP2 Displayname", + # org_url: "http://idp2.samly.howto:4003" }, %{ id: "sp3", entity_id: "urn:idp3.samly.howto:sp3", certfile: "samly.crt", - keyfile: "samly.pem", - #contact_name: "Samly Howto SP3 Admin", - #contact_email: "sp3-admin@samly.howto", - #org_name: "Samly Howto SP3", - #org_displayname: "Samly Howto SP3 Displayname", - #org_url: "http://idp3.samly.howto:4003" + keyfile: "samly.pem" + # contact_name: "Samly Howto SP3 Admin", + # contact_email: "sp3-admin@samly.howto", + # org_name: "Samly Howto SP3", + # org_displayname: "Samly Howto SP3 Displayname", + # org_url: "http://idp3.samly.howto:4003" } ], identity_providers: [ @@ -93,35 +102,35 @@ config :samly, Samly.Provider, sp_id: "sp1", base_url: "http://samly.howto:4003/sso", metadata_file: "idp_metadata.xml", - pre_session_create_pipeline: SamlyHowtoWeb.Plugs.SamlyPipeline, - #use_redirect_for_req: false, - #sign_requests: true, - #sign_metadata: true, - #signed_assertion_in_resp: true, - #signed_envelopes_in_resp: true + pre_session_create_pipeline: SamlyHowtoWeb.Plugs.SamlyPipeline + # use_redirect_for_req: false, + # sign_requests: true, + # sign_metadata: true, + # signed_assertion_in_resp: true, + # signed_envelopes_in_resp: true }, %{ id: "idp2", sp_id: "sp2", base_url: "http://idp2.samly.howto:4003/sso", metadata_file: "idp_metadata.xml", - pre_session_create_pipeline: SamlyHowtoWeb.Plugs.SamlyPipeline, - #use_redirect_for_req: false, - #sign_requests: true, - #sign_metadata: true, - #signed_assertion_in_resp: true, - #signed_envelopes_in_resp: true + pre_session_create_pipeline: SamlyHowtoWeb.Plugs.SamlyPipeline + # use_redirect_for_req: false, + # sign_requests: true, + # sign_metadata: true, + # signed_assertion_in_resp: true, + # signed_envelopes_in_resp: true }, %{ id: "idp3", sp_id: "sp3", base_url: "http://idp3.samly.howto:4003/sso", metadata_file: "idp_metadata.xml", - pre_session_create_pipeline: SamlyHowtoWeb.Plugs.SamlyPipeline, - #use_redirect_for_req: false, - #sign_requests: true, - #sign_metadata: true, - #signed_assertion_in_resp: true, - #signed_envelopes_in_resp: true + pre_session_create_pipeline: SamlyHowtoWeb.Plugs.SamlyPipeline + # use_redirect_for_req: false, + # sign_requests: true, + # sign_metadata: true, + # signed_assertion_in_resp: true, + # signed_envelopes_in_resp: true } ] diff --git a/lib/samly_howto/application.ex b/lib/samly_howto/application.ex index d15ee01..68d1ba8 100644 --- a/lib/samly_howto/application.ex +++ b/lib/samly_howto/application.ex @@ -12,7 +12,7 @@ defmodule SamlyHowto.Application do supervisor(SamlyHowtoWeb.Endpoint, []), # Start your own worker by calling: SamlyHowto.Worker.start_link(arg1, arg2, arg3) # worker(SamlyHowto.Worker, [arg1, arg2, arg3]), - worker(Samly.Provider, []), + worker(Samly.Provider, []) ] # See https://hexdocs.pm/elixir/Supervisor.html diff --git a/lib/samly_howto_web.ex b/lib/samly_howto_web.ex index a1a9eef..2984575 100644 --- a/lib/samly_howto_web.ex +++ b/lib/samly_howto_web.ex @@ -28,8 +28,9 @@ defmodule SamlyHowtoWeb do def view do quote do - use Phoenix.View, root: "lib/samly_howto_web/templates", - namespace: SamlyHowtoWeb + use Phoenix.View, + root: "lib/samly_howto_web/templates", + namespace: SamlyHowtoWeb # Import convenience functions from controllers import Phoenix.Controller, only: [get_flash: 2, view_module: 1] diff --git a/lib/samly_howto_web/channels/user_socket.ex b/lib/samly_howto_web/channels/user_socket.ex index fe4259f..1b9e594 100644 --- a/lib/samly_howto_web/channels/user_socket.ex +++ b/lib/samly_howto_web/channels/user_socket.ex @@ -5,7 +5,7 @@ defmodule SamlyHowtoWeb.UserSocket do # channel "room:*", SamlyHowtoWeb.RoomChannel ## Transports - transport :websocket, Phoenix.Transports.WebSocket + transport(:websocket, Phoenix.Transports.WebSocket) # transport :longpoll, Phoenix.Transports.LongPoll # Socket params are passed from the client and can diff --git a/lib/samly_howto_web/controllers/page_controller.ex b/lib/samly_howto_web/controllers/page_controller.ex index 153e32a..ca586fb 100644 --- a/lib/samly_howto_web/controllers/page_controller.ex +++ b/lib/samly_howto_web/controllers/page_controller.ex @@ -4,15 +4,20 @@ defmodule SamlyHowtoWeb.PageController do def index(conn, _params) do assertion = Samly.get_active_assertion(conn) uid = Samly.get_attribute(assertion, "uid") - {idp_id, attributes, computed} = if assertion do - {assertion.idp_id, assertion.attributes, assertion.computed} - else - {nil, nil, nil} - end + + {idp_id, attributes, computed} = + if assertion do + {assertion.idp_id, assertion.attributes, assertion.computed} + else + {nil, nil, nil} + end target_url = "/?a=value1&b=value two" |> URI.encode_www_form() {metadata_uri, signin_uri, signout_uri} = get_samly_uris() - render conn, "index.html", [ + + render( + conn, + "index.html", idp_id: idp_id, uid: uid, attributes: attributes, @@ -21,11 +26,12 @@ defmodule SamlyHowtoWeb.PageController do metadata_uri: metadata_uri, signin_uri: signin_uri, signout_uri: signout_uri - ] + ) end defp get_samly_uris() do opts = Application.get_env(:samly, Samly.Provider, []) + if opts[:idp_id_from] == :subdomain do { "/sso/sp/metadata", diff --git a/lib/samly_howto_web/endpoint.ex b/lib/samly_howto_web/endpoint.ex index ee8b370..c3bb481 100644 --- a/lib/samly_howto_web/endpoint.ex +++ b/lib/samly_howto_web/endpoint.ex @@ -1,20 +1,22 @@ defmodule SamlyHowtoWeb.Endpoint do use Phoenix.Endpoint, otp_app: :samly_howto - socket "/socket", SamlyHowtoWeb.UserSocket + socket("/socket", SamlyHowtoWeb.UserSocket) # Serve at "/" the static files from "priv/static" directory. # # You should set gzip to true if you are running phoenix.digest # when deploying your static files in production. plug Plug.Static, - at: "/", from: :samly_howto, gzip: false, + at: "/", + from: :samly_howto, + gzip: false, only: ~w(css fonts images js favicon.ico robots.txt) # Code reloading can be explicitly enabled under the # :code_reloader configuration of your endpoint. if code_reloading? do - socket "/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket + socket("/phoenix/live_reload/socket", Phoenix.LiveReloader.Socket) plug Phoenix.LiveReloader plug Phoenix.CodeReloader end diff --git a/lib/samly_howto_web/plugs/samly_pipeline.ex b/lib/samly_howto_web/plugs/samly_pipeline.ex index 112cd2e..64e0d5f 100644 --- a/lib/samly_howto_web/plugs/samly_pipeline.ex +++ b/lib/samly_howto_web/plugs/samly_pipeline.ex @@ -9,14 +9,15 @@ defmodule SamlyHowtoWeb.Plugs.SamlyPipeline do assertion = conn.private[:samly_assertion] first_name = Map.get(assertion.attributes, "first_name") - last_name = Map.get(assertion.attributes, "last_name") + last_name = Map.get(assertion.attributes, "last_name") computed = %{"full_name" => "#{first_name} #{last_name}"} assertion = %Assertion{assertion | computed: computed} conn - |> put_private(:samly_assertion, assertion) + |> put_private(:samly_assertion, assertion) + # |> send_resp(404, "attribute mapping failed") # |> halt() end diff --git a/lib/samly_howto_web/router.ex b/lib/samly_howto_web/router.ex index d4cbd8a..026b5fc 100644 --- a/lib/samly_howto_web/router.ex +++ b/lib/samly_howto_web/router.ex @@ -14,13 +14,14 @@ defmodule SamlyHowtoWeb.Router do end scope "/sso" do - forward "/", Samly.Router + forward("/", Samly.Router) end scope "/", SamlyHowtoWeb do - pipe_through :browser # Use the default browser stack + # Use the default browser stack + pipe_through(:browser) - get "/", PageController, :index + get("/", PageController, :index) end # Other scopes may use custom stacks. diff --git a/lib/samly_howto_web/views/error_helpers.ex b/lib/samly_howto_web/views/error_helpers.ex index 677f43f..93d2251 100644 --- a/lib/samly_howto_web/views/error_helpers.ex +++ b/lib/samly_howto_web/views/error_helpers.ex @@ -9,8 +9,8 @@ defmodule SamlyHowtoWeb.ErrorHelpers do Generates tag for inlined form input errors. """ def error_tag(form, field) do - Enum.map(Keyword.get_values(form.errors, field), fn (error) -> - content_tag :span, translate_error(error), class: "help-block" + Enum.map(Keyword.get_values(form.errors, field), fn error -> + content_tag(:span, translate_error(error), class: "help-block") end) end diff --git a/lib/samly_howto_web/views/error_view.ex b/lib/samly_howto_web/views/error_view.ex index 24220c5..4d99f16 100644 --- a/lib/samly_howto_web/views/error_view.ex +++ b/lib/samly_howto_web/views/error_view.ex @@ -12,6 +12,6 @@ defmodule SamlyHowtoWeb.ErrorView do # In case no render clause matches or no # template is found, let's render it as 500 def template_not_found(_template, assigns) do - render "500.html", assigns + render("500.html", assigns) end end diff --git a/mix.exs b/mix.exs index 35467bf..bfd72b6 100644 --- a/mix.exs +++ b/mix.exs @@ -4,11 +4,11 @@ defmodule SamlyHowto.Mixfile do def project do [ app: :samly_howto, - version: "0.6.0", + version: "0.6.1", elixir: "~> 1.4", - elixirc_paths: elixirc_paths(Mix.env), - compilers: [:phoenix, :gettext] ++ Mix.compilers, - start_permanent: Mix.env == :prod, + elixirc_paths: elixirc_paths(Mix.env()), + compilers: [:phoenix, :gettext] ++ Mix.compilers(), + start_permanent: Mix.env() == :prod, deps: deps() ] end @@ -25,7 +25,7 @@ defmodule SamlyHowto.Mixfile do # Specifies which paths to compile per environment. defp elixirc_paths(:test), do: ["lib", "test/support"] - defp elixirc_paths(_), do: ["lib"] + defp elixirc_paths(_), do: ["lib"] # Specifies your project dependencies. # @@ -38,7 +38,7 @@ defmodule SamlyHowto.Mixfile do {:phoenix_live_reload, "~> 1.0", only: :dev}, {:gettext, "~> 0.11"}, {:cowboy, "~> 1.0"}, - {:samly, "~> 0.8"}, + {:samly, "~> 0.8"} ] end end diff --git a/mix.lock b/mix.lock index 5e9bad7..46024ec 100644 --- a/mix.lock +++ b/mix.lock @@ -1,14 +1,14 @@ -%{"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"}, - "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [], [], "hexpm"}, - "esaml": {:hex, :esaml, "3.1.0", "76337f00b5953a6c249fa8c322905c7a069b7c20339ece3756072279e6dcb41c", [], [{:cowboy, "1.1.2", [hex: :cowboy, repo: "hexpm", optional: false]}], "hexpm"}, - "file_system": {:hex, :file_system, "0.2.2", "7f1e9de4746f4eb8a4ca8f2fbab582d84a4e40fa394cce7bfcb068b988625b06", [], [], "hexpm"}, - "gettext": {:hex, :gettext, "0.13.1", "5e0daf4e7636d771c4c71ad5f3f53ba09a9ae5c250e1ab9c42ba9edccc476263", [], [], "hexpm"}, - "mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [], [], "hexpm"}, - "phoenix": {:hex, :phoenix, "1.3.0", "1c01124caa1b4a7af46f2050ff11b267baa3edb441b45dbf243e979cd4c5891b", [], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, - "phoenix_html": {:hex, :phoenix_html, "2.10.4", "d4f99c32d5dc4918b531fdf163e1fd7cf20acdd7703f16f5d02d4db36de803b7", [], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, - "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.1.3", "1d178429fc8950b12457d09c6afec247bfe1fcb6f36209e18fbb0221bdfe4d41", [], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.0 or ~> 1.2 or ~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm"}, - "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [], [], "hexpm"}, - "plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, - "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [], [], "hexpm"}, - "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [], [], "hexpm"}, - "samly": {:hex, :samly, "0.8.0", "c690b454b1d1e1d583961807824a84ff5a49b2c25ae5eb80e21dc31af5d335b7", [], [{:esaml, "~> 3.1", [hex: :esaml, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}} +%{"cowboy": {:hex, :cowboy, "1.1.2", "61ac29ea970389a88eca5a65601460162d370a70018afe6f949a29dca91f3bb0", [:rebar3], [{:cowlib, "~> 1.0.2", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "~> 1.3.2", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm"}, + "cowlib": {:hex, :cowlib, "1.0.2", "9d769a1d062c9c3ac753096f868ca121e2730b9a377de23dec0f7e08b1df84ee", [:make], [], "hexpm"}, + "esaml": {:hex, :esaml, "3.1.0", "76337f00b5953a6c249fa8c322905c7a069b7c20339ece3756072279e6dcb41c", [:rebar3], [{:cowboy, "1.1.2", [hex: :cowboy, repo: "hexpm", optional: false]}], "hexpm"}, + "file_system": {:hex, :file_system, "0.2.2", "7f1e9de4746f4eb8a4ca8f2fbab582d84a4e40fa394cce7bfcb068b988625b06", [:mix], [], "hexpm"}, + "gettext": {:hex, :gettext, "0.13.1", "5e0daf4e7636d771c4c71ad5f3f53ba09a9ae5c250e1ab9c42ba9edccc476263", [:mix], [], "hexpm"}, + "mime": {:hex, :mime, "1.1.0", "01c1d6f4083d8aa5c7b8c246ade95139620ef8effb009edde934e0ec3b28090a", [:mix], [], "hexpm"}, + "phoenix": {:hex, :phoenix, "1.3.0", "1c01124caa1b4a7af46f2050ff11b267baa3edb441b45dbf243e979cd4c5891b", [:mix], [{:cowboy, "~> 1.0", [hex: :cowboy, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.3.3 or ~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}, {:poison, "~> 2.2 or ~> 3.0", [hex: :poison, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix_html": {:hex, :phoenix_html, "2.10.4", "d4f99c32d5dc4918b531fdf163e1fd7cf20acdd7703f16f5d02d4db36de803b7", [:mix], [{:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.1.3", "1d178429fc8950b12457d09c6afec247bfe1fcb6f36209e18fbb0221bdfe4d41", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.0 or ~> 1.2 or ~> 1.3", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm"}, + "phoenix_pubsub": {:hex, :phoenix_pubsub, "1.0.2", "bfa7fd52788b5eaa09cb51ff9fcad1d9edfeb68251add458523f839392f034c1", [:mix], [], "hexpm"}, + "plug": {:hex, :plug, "1.4.3", "236d77ce7bf3e3a2668dc0d32a9b6f1f9b1f05361019946aae49874904be4aed", [:mix], [{:cowboy, "~> 1.0.1 or ~> 1.1", [hex: :cowboy, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}], "hexpm"}, + "poison": {:hex, :poison, "3.1.0", "d9eb636610e096f86f25d9a46f35a9facac35609a7591b3be3326e99a0484665", [:mix], [], "hexpm"}, + "ranch": {:hex, :ranch, "1.3.2", "e4965a144dc9fbe70e5c077c65e73c57165416a901bd02ea899cfd95aa890986", [:rebar3], [], "hexpm"}, + "samly": {:hex, :samly, "0.8.1", "483aaa0191eaf9f0c00c1896da5e7bbd3376804b9a8db88282a27eb20d94e432", [], [{:esaml, "~> 3.1", [hex: :esaml, repo: "hexpm", optional: false]}, {:plug, "~> 1.4", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"}} diff --git a/test/samly_howto_web/controllers/page_controller_test.exs b/test/samly_howto_web/controllers/page_controller_test.exs index e303f64..f63b836 100644 --- a/test/samly_howto_web/controllers/page_controller_test.exs +++ b/test/samly_howto_web/controllers/page_controller_test.exs @@ -2,7 +2,7 @@ defmodule SamlyHowtoWeb.PageControllerTest do use SamlyHowtoWeb.ConnCase test "GET /", %{conn: conn} do - conn = get conn, "/" + conn = get(conn, "/") assert html_response(conn, 200) =~ "Welcome to Phoenix!" end end diff --git a/test/samly_howto_web/views/error_view_test.exs b/test/samly_howto_web/views/error_view_test.exs index c3b8522..43c1e70 100644 --- a/test/samly_howto_web/views/error_view_test.exs +++ b/test/samly_howto_web/views/error_view_test.exs @@ -5,17 +5,14 @@ defmodule SamlyHowtoWeb.ErrorViewTest do import Phoenix.View test "renders 404.html" do - assert render_to_string(SamlyHowtoWeb.ErrorView, "404.html", []) == - "Page not found" + assert render_to_string(SamlyHowtoWeb.ErrorView, "404.html", []) == "Page not found" end test "render 500.html" do - assert render_to_string(SamlyHowtoWeb.ErrorView, "500.html", []) == - "Internal server error" + assert render_to_string(SamlyHowtoWeb.ErrorView, "500.html", []) == "Internal server error" end test "render any other" do - assert render_to_string(SamlyHowtoWeb.ErrorView, "505.html", []) == - "Internal server error" + assert render_to_string(SamlyHowtoWeb.ErrorView, "505.html", []) == "Internal server error" end end diff --git a/test/support/channel_case.ex b/test/support/channel_case.ex index 2e92fe9..0ad5bf0 100644 --- a/test/support/channel_case.ex +++ b/test/support/channel_case.ex @@ -25,9 +25,7 @@ defmodule SamlyHowtoWeb.ChannelCase do end end - setup _tags do :ok end - end diff --git a/test/support/conn_case.ex b/test/support/conn_case.ex index d058ee7..bab4186 100644 --- a/test/support/conn_case.ex +++ b/test/support/conn_case.ex @@ -26,9 +26,7 @@ defmodule SamlyHowtoWeb.ConnCase do end end - setup _tags do {:ok, conn: Phoenix.ConnTest.build_conn()} end - end diff --git a/test/test_helper.exs b/test/test_helper.exs index 0a76a58..869559e 100644 --- a/test/test_helper.exs +++ b/test/test_helper.exs @@ -1,2 +1 @@ ExUnit.start() -