Skip to content

Commit

Permalink
add unhappy path test for AuthWeb.AuthController.client_id_is_current?
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Oct 17, 2022
1 parent ec21cc9 commit 01d5617
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/auth_web/controllers/auth_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ defmodule AuthWeb.AuthController do

# return true if the app_id is linked to the client_id otherwise false
# Check if the api key hasn't been deleted
defp client_id_is_current?(app_id, client_id) do
def client_id_is_current?(app_id, client_id) do
case Auth.Apikey.get_apikey_by_app_id(app_id) do
nil ->
false
Expand Down
4 changes: 4 additions & 0 deletions test/auth_web/controllers/auth_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -512,4 +512,8 @@ defmodule AuthWeb.AuthControllerTest do
conn2 = conn |> admin_login() |> get("/logout", %{})
assert html_response(conn2, 200) =~ "Successfully logged out."
end

test "client_id_is_current? nil path" do
assert AuthWeb.AuthController.client_id_is_current?(0, 1) == false
end
end

0 comments on commit 01d5617

Please sign in to comment.