fix broken doctests and test var refs

This commit is contained in:
Graham McIntire 2026-06-16 10:52:50 -05:00
parent 58daf45b60
commit 3c2e22fe0d
2 changed files with 2 additions and 46 deletions

View file

@ -103,12 +103,6 @@ defmodule Towerops.Accounts do
@doc """ @doc """
Returns an `%Ecto.Changeset{}` for tracking user registration changes. Returns an `%Ecto.Changeset{}` for tracking user registration changes.
## Examples
iex> change_user_registration(user)
%Ecto.Changeset{data: %User{}}
""" """
@spec change_user_registration(User.t(), map()) :: Ecto.Changeset.t() @spec change_user_registration(User.t(), map()) :: Ecto.Changeset.t()
def change_user_registration(%User{} = user, attrs \\ %{}) do def change_user_registration(%User{} = user, attrs \\ %{}) do
@ -117,15 +111,6 @@ defmodule Towerops.Accounts do
@doc """ @doc """
Registers a user with email and password. Registers a user with email and password.
## Examples
iex> register_user(%{field: value})
{:ok, %User{}}
iex> register_user(%{field: bad_value})
{:error, %Ecto.Changeset{}}
""" """
@spec register_user(map()) :: {:ok, User.t()} | {:error, Ecto.Changeset.t()} @spec register_user(map()) :: {:ok, User.t()} | {:error, Ecto.Changeset.t()}
def register_user(attrs) do def register_user(attrs) do
@ -143,15 +128,6 @@ defmodule Towerops.Accounts do
@doc """ @doc """
Registers a user with email and password, and creates a default organization. Registers a user with email and password, and creates a default organization.
## Examples
iex> register_user_with_organization(%{field: value})
{:ok, %User{}}
iex> register_user_with_organization(%{field: bad_value})
{:error, %Ecto.Changeset{}}
""" """
@spec register_user_with_organization(map()) :: {:ok, User.t()} | {:error, Ecto.Changeset.t()} @spec register_user_with_organization(map()) :: {:ok, User.t()} | {:error, Ecto.Changeset.t()}
def register_user_with_organization(attrs) do def register_user_with_organization(attrs) do
@ -199,12 +175,6 @@ defmodule Towerops.Accounts do
@doc """ @doc """
Returns an `%Ecto.Changeset{}` for changing the user profile. Returns an `%Ecto.Changeset{}` for changing the user profile.
## Examples
iex> change_user_profile(user)
%Ecto.Changeset{data: %User{}}
""" """
def change_user_profile(user, attrs \\ %{}) do def change_user_profile(user, attrs \\ %{}) do
User.profile_changeset(user, attrs) User.profile_changeset(user, attrs)
@ -212,15 +182,6 @@ defmodule Towerops.Accounts do
@doc """ @doc """
Updates the user profile. Updates the user profile.
## Examples
iex> update_user_profile(user, %{name: ...})
{:ok, %User{}}
iex> update_user_profile(user, %{name: bad_value})
{:error, %Ecto.Changeset{}}
""" """
def update_user_profile(user, attrs) do def update_user_profile(user, attrs) do
user user
@ -246,11 +207,6 @@ defmodule Towerops.Accounts do
Grants sudo mode to a user by updating their last_sudo_at timestamp. Grants sudo mode to a user by updating their last_sudo_at timestamp.
Returns `{:ok, user}` on success or `{:error, changeset}` on failure. Returns `{:ok, user}` on success or `{:error, changeset}` on failure.
## Examples
iex> grant_sudo_mode(user)
{:ok, %User{last_sudo_at: ~U[2026-02-01 12:00:00Z]}}
""" """
def grant_sudo_mode(%User{} = user) do def grant_sudo_mode(%User{} = user) do
now = Towerops.Time.now() now = Towerops.Time.now()

View file

@ -1127,8 +1127,8 @@ defmodule Towerops.AccountsTest do
test "returns active consent for user and type" do test "returns active consent for user and type" do
user = user_fixture() user = user_fixture()
# user_fixture already grants consents during registration # user_fixture already grants consents during registration
assert %{consent_type: consent_type} = Accounts.get_active_consent(user.id, "privacy_policy") active = Accounts.get_active_consent(user.id, "privacy_policy")
assert consent_type == "privacy_policy" assert active.consent_type == "privacy_policy"
assert is_nil(active.revoked_at) assert is_nil(active.revoked_at)
end end