Skip to content

Commit

Permalink
test: update GETs in tests to reflect non-admin update
Browse files Browse the repository at this point in the history
  • Loading branch information
meagharty committed Feb 8, 2024
1 parent f8ad8dd commit 4df9f91
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/arrow_web/controllers/api/adjustment_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ defmodule ArrowWeb.API.AdjustmentControllerTest do

describe "index/2" do
@tag :authenticated
test "non-admin user can't access the adjustments API", %{conn: conn} do
assert conn |> get("/api/adjustments") |> redirected_to() == "/unauthorized"
test "non-admin user can access the adjustments API", %{conn: conn} do
assert %{status: 200} = get(conn, "/api/adjustments")
end

@tag :authenticated_admin
Expand Down
4 changes: 2 additions & 2 deletions test/arrow_web/controllers/api/disruption_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ defmodule ArrowWeb.API.DisruptionControllerTest do

describe "index/2" do
@tag :authenticated
test "non-admin user can't access the disruptions API", %{conn: conn} do
assert conn |> get("/api/disruptions") |> redirected_to() == "/unauthorized"
test "non-admin user can access the disruptions API", %{conn: conn} do
assert %{status: 200} = get(conn, "/api/disruptions")
end

@tag :authenticated_admin
Expand Down
8 changes: 4 additions & 4 deletions test/arrow_web/controllers/my_token_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ defmodule ArrowWeb.MyTokenControllerTest do

@tag :authenticated_admin
test "GET /mytoken", %{conn: conn} do
conn = get(conn, routes.my_token_path(conn, :show))
assert html_response(conn, 200) =~ "your token is"
conn = get(conn, Routes.my_token_path(conn, :show))
assert html_response(conn, 200) =~ "Your token is"
end

@tag :authenticated
test "non-admin user can get their API token", %{conn: conn} do
conn = get(conn, routes.my_token_path(conn, :show))
assert html_response(conn, 200) =~ "your token is"
conn = get(conn, Routes.my_token_path(conn, :show))
assert html_response(conn, 200) =~ "Your token is"
end
end

0 comments on commit 4df9f91

Please sign in to comment.