diff --git a/.iex.exs b/.iex.exs index ebe1a24..b21b432 100644 --- a/.iex.exs +++ b/.iex.exs @@ -11,7 +11,7 @@ alias Pinchflat.Tasks alias Pinchflat.Media alias Pinchflat.Profiles alias Pinchflat.Sources -alias Pinchflat.Settings +alias Pinchflat.SettingsBackup alias Pinchflat.Downloading.MediaDownloader alias Pinchflat.YtDlp.Media, as: YtDlpMedia diff --git a/lib/pinchflat/boot/pre_job_startup_tasks.ex b/lib/pinchflat/boot/pre_job_startup_tasks.ex index bc52ee1..fd9c1df 100644 --- a/lib/pinchflat/boot/pre_job_startup_tasks.ex +++ b/lib/pinchflat/boot/pre_job_startup_tasks.ex @@ -13,7 +13,7 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do require Logger alias Pinchflat.Repo - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup alias Pinchflat.YtDlp.CommandRunner alias Pinchflat.Filesystem.FilesystemHelpers @@ -65,8 +65,8 @@ defmodule Pinchflat.Boot.PreJobStartupTasks do defp apply_default_settings do {:ok, yt_dlp_version} = CommandRunner.version() - Settings.fetch!(:onboarding, true) - Settings.fetch!(:pro_enabled, false) - Settings.set!(:yt_dlp_version, yt_dlp_version) + SettingsBackup.fetch!(:onboarding, true) + SettingsBackup.fetch!(:pro_enabled, false) + SettingsBackup.set!(:yt_dlp_version, yt_dlp_version) end end diff --git a/lib/pinchflat/settings/setting.ex b/lib/pinchflat/settings/setting_backup.ex similarity index 86% rename from lib/pinchflat/settings/setting.ex rename to lib/pinchflat/settings/setting_backup.ex index fab97b9..5e5b43c 100644 --- a/lib/pinchflat/settings/setting.ex +++ b/lib/pinchflat/settings/setting_backup.ex @@ -1,4 +1,4 @@ -defmodule Pinchflat.Settings.Setting do +defmodule Pinchflat.SettingsBackup.SettingBackup do @moduledoc """ A Setting is a key-value pair with a datatype used to track user-level settings. """ @@ -6,7 +6,7 @@ defmodule Pinchflat.Settings.Setting do use Ecto.Schema import Ecto.Changeset - schema "settings" do + schema "settings_backup" do field :name, :string field :value, :string field :datatype, Ecto.Enum, values: ~w(boolean string integer float)a diff --git a/lib/pinchflat/settings/settings.ex b/lib/pinchflat/settings/settings_backup.ex similarity index 86% rename from lib/pinchflat/settings/settings.ex rename to lib/pinchflat/settings/settings_backup.ex index 29db085..801758b 100644 --- a/lib/pinchflat/settings/settings.ex +++ b/lib/pinchflat/settings/settings_backup.ex @@ -1,20 +1,20 @@ -defmodule Pinchflat.Settings do +defmodule Pinchflat.SettingsBackup do @moduledoc """ - The Settings context. + The SettingsBackup context. """ import Ecto.Query, warn: false alias Pinchflat.Repo - alias Pinchflat.Settings.Setting + alias Pinchflat.SettingsBackup.SettingBackup @doc """ Returns the list of settings. - Returns [%Setting{}, ...] + Returns [%SettingBackup{}, ...] """ def list_settings do - Repo.all(Setting) + Repo.all(SettingBackup) end @doc """ @@ -30,7 +30,7 @@ defmodule Pinchflat.Settings do def set!(name, value, datatype) do # Only create if doesn't exist - case Repo.get_by(Setting, name: to_string(name)) do + case Repo.get_by(SettingBackup, name: to_string(name)) do nil -> create_setting!(name, value, datatype) setting -> update_setting!(setting, value, datatype) end @@ -42,7 +42,7 @@ defmodule Pinchflat.Settings do Returns value in type of `Ecto.Enum.mappings(Setting, :datatype)` """ def get!(name) do - Setting + SettingBackup |> Repo.get_by!(name: to_string(name)) |> read_setting() end @@ -59,18 +59,18 @@ defmodule Pinchflat.Settings do end def fetch!(name, value, datatype) do - case Repo.get_by(Setting, name: to_string(name)) do + case Repo.get_by(SettingBackup, name: to_string(name)) do nil -> create_setting!(name, value, datatype) setting -> read_setting(setting) end end defp change_setting(setting, attrs) do - Setting.changeset(setting, attrs) + SettingBackup.changeset(setting, attrs) end defp create_setting!(name, value, datatype) do - %Setting{} + %SettingBackup{} |> change_setting(%{name: to_string(name), value: to_string(value), datatype: datatype}) |> Repo.insert!() |> read_setting() diff --git a/lib/pinchflat_web.ex b/lib/pinchflat_web.ex index ef58d00..67ca937 100644 --- a/lib/pinchflat_web.ex +++ b/lib/pinchflat_web.ex @@ -45,7 +45,7 @@ defmodule PinchflatWeb do import Plug.Conn import PinchflatWeb.Gettext - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup alias PinchflatWeb.Layouts unquote(verified_routes()) @@ -58,7 +58,7 @@ defmodule PinchflatWeb do use Phoenix.LiveView - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup unquote(html_helpers()) end @@ -68,7 +68,7 @@ defmodule PinchflatWeb do quote do use Phoenix.LiveComponent - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup unquote(html_helpers()) end @@ -82,7 +82,7 @@ defmodule PinchflatWeb do import Phoenix.Controller, only: [get_csrf_token: 0, view_module: 1, view_template: 1] - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup # Include general helpers for rendering HTML unquote(html_helpers()) @@ -101,7 +101,7 @@ defmodule PinchflatWeb do import PinchflatWeb.CustomComponents.TableComponents import PinchflatWeb.CustomComponents.ButtonComponents - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup alias Pinchflat.Utils.StringUtils # Shortcut for generating JS commands diff --git a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex index 978c471..2243f28 100644 --- a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex +++ b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex @@ -62,7 +62,7 @@ Pinchflat v<%= Application.spec(:pinchflat)[:vsn] %> - yt-dlp <%= Settings.get!(:yt_dlp_version) %> + yt-dlp <%= SettingsBackup.get!(:yt_dlp_version) %> diff --git a/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex b/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex index 89c205b..2e05506 100644 --- a/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex +++ b/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex @@ -30,7 +30,7 @@ defmodule Pinchflat.UpgradeButtonLive do |> String.downcase() if normalized_text == "got it!" do - Settings.set!(:pro_enabled, true) + SettingsBackup.set!(:pro_enabled, true) {:noreply, update(socket, :button_disabled, fn _ -> false end)} else diff --git a/lib/pinchflat_web/components/layouts/root.html.heex b/lib/pinchflat_web/components/layouts/root.html.heex index 52f7e5f..f722ce3 100644 --- a/lib/pinchflat_web/components/layouts/root.html.heex +++ b/lib/pinchflat_web/components/layouts/root.html.heex @@ -15,8 +15,8 @@ diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_controller.ex b/lib/pinchflat_web/controllers/media_profiles/media_profile_controller.ex index cc638ec..76f9cc6 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_controller.ex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_controller.ex @@ -27,7 +27,7 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileController do case Profiles.create_media_profile(media_profile_params) do {:ok, media_profile} -> redirect_location = - if Settings.get!(:onboarding), do: ~p"/?onboarding=1", else: ~p"/media_profiles/#{media_profile}" + if SettingsBackup.get!(:onboarding), do: ~p"/?onboarding=1", else: ~p"/media_profiles/#{media_profile}" conn |> put_flash(:info, "Media profile created successfully.") @@ -89,7 +89,7 @@ defmodule PinchflatWeb.MediaProfiles.MediaProfileController do end defp get_onboarding_layout do - if Settings.get!(:onboarding) do + if SettingsBackup.get!(:onboarding) do {Layouts, :onboarding} else {Layouts, :app} diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex index fe3e9e7..b5d2c96 100644 --- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex +++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/new.html.heex @@ -1,5 +1,5 @@
- <.link :if={!Settings.get!(:onboarding)} href={~p"/media_profiles"}> + <.link :if={!SettingsBackup.get!(:onboarding)} href={~p"/media_profiles"}> <.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />

New Media Profile

diff --git a/lib/pinchflat_web/controllers/pages/page_controller.ex b/lib/pinchflat_web/controllers/pages/page_controller.ex index 50d1a46..fe066dd 100644 --- a/lib/pinchflat_web/controllers/pages/page_controller.ex +++ b/lib/pinchflat_web/controllers/pages/page_controller.ex @@ -11,9 +11,9 @@ defmodule PinchflatWeb.Pages.PageController do done_onboarding = params["onboarding"] == "0" force_onboarding = params["onboarding"] == "1" - if done_onboarding, do: Settings.set!(:onboarding, false) + if done_onboarding, do: SettingsBackup.set!(:onboarding, false) - if force_onboarding || Settings.get!(:onboarding) do + if force_onboarding || SettingsBackup.get!(:onboarding) do render_onboarding_page(conn) else render_home_page(conn) @@ -30,7 +30,7 @@ defmodule PinchflatWeb.Pages.PageController do end defp render_onboarding_page(conn) do - Settings.set!(:onboarding, true) + SettingsBackup.set!(:onboarding, true) conn |> render(:onboarding_checklist, diff --git a/lib/pinchflat_web/controllers/sources/source_controller.ex b/lib/pinchflat_web/controllers/sources/source_controller.ex index d8e904d..945bb94 100644 --- a/lib/pinchflat_web/controllers/sources/source_controller.ex +++ b/lib/pinchflat_web/controllers/sources/source_controller.ex @@ -37,7 +37,7 @@ defmodule PinchflatWeb.Sources.SourceController do case Sources.create_source(source_params) do {:ok, source} -> redirect_location = - if Settings.get!(:onboarding), do: ~p"/?onboarding=1", else: ~p"/sources/#{source}" + if SettingsBackup.get!(:onboarding), do: ~p"/?onboarding=1", else: ~p"/sources/#{source}" conn |> put_flash(:info, "Source created successfully.") @@ -159,7 +159,7 @@ defmodule PinchflatWeb.Sources.SourceController do end defp get_onboarding_layout do - if Settings.get!(:onboarding) do + if SettingsBackup.get!(:onboarding) do {Layouts, :onboarding} else {Layouts, :app} diff --git a/lib/pinchflat_web/controllers/sources/source_html/new.html.heex b/lib/pinchflat_web/controllers/sources/source_html/new.html.heex index 2817c78..0505567 100644 --- a/lib/pinchflat_web/controllers/sources/source_html/new.html.heex +++ b/lib/pinchflat_web/controllers/sources/source_html/new.html.heex @@ -1,5 +1,5 @@
- <.link :if={!Settings.get!(:onboarding)} href={~p"/sources"}> + <.link :if={!SettingsBackup.get!(:onboarding)} href={~p"/sources"}> <.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />

New Source

diff --git a/priv/repo/migrations/20240306173305_create_settings.exs b/priv/repo/migrations/20240306173305_create_settings.exs index 5d84539..0a1819a 100644 --- a/priv/repo/migrations/20240306173305_create_settings.exs +++ b/priv/repo/migrations/20240306173305_create_settings.exs @@ -1,4 +1,4 @@ -defmodule Pinchflat.Repo.Migrations.CreateSettings do +defmodule Pinchflat.Repo.Migrations.CreateSettingsBackup do use Ecto.Migration def change do diff --git a/priv/repo/migrations/20240404172256_rename_settings_table.exs b/priv/repo/migrations/20240404172256_rename_settings_table.exs new file mode 100644 index 0000000..6147ddf --- /dev/null +++ b/priv/repo/migrations/20240404172256_rename_settings_table.exs @@ -0,0 +1,7 @@ +defmodule Pinchflat.Repo.Migrations.RenameSettingsBackupTable do + use Ecto.Migration + + def change do + rename table(:settings), to: table(:settings_backup) + end +end diff --git a/test/pinchflat/boot/pre_job_startup_tasks_test.exs b/test/pinchflat/boot/pre_job_startup_tasks_test.exs index 0c41c24..ae2f954 100644 --- a/test/pinchflat/boot/pre_job_startup_tasks_test.exs +++ b/test/pinchflat/boot/pre_job_startup_tasks_test.exs @@ -1,25 +1,25 @@ defmodule Pinchflat.Boot.PreJobStartupTasksTest do use Pinchflat.DataCase - alias Pinchflat.Settings - alias Pinchflat.Settings.Setting + alias Pinchflat.SettingsBackup + alias Pinchflat.SettingsBackup.SettingBackup alias Pinchflat.Boot.PreJobStartupTasks describe "apply_default_settings" do setup do - Repo.delete_all(Setting) + Repo.delete_all(SettingBackup) :ok end test "sets default settings" do - assert_raise Ecto.NoResultsError, fn -> Settings.get!(:onboarding) end - assert_raise Ecto.NoResultsError, fn -> Settings.get!(:pro_enabled) end + assert_raise Ecto.NoResultsError, fn -> SettingsBackup.get!(:onboarding) end + assert_raise Ecto.NoResultsError, fn -> SettingsBackup.get!(:pro_enabled) end PreJobStartupTasks.start_link() - assert Settings.get!(:onboarding) - refute Settings.get!(:pro_enabled) + assert SettingsBackup.get!(:onboarding) + refute SettingsBackup.get!(:pro_enabled) end end end diff --git a/test/pinchflat/settings_test.exs b/test/pinchflat/settings_test.exs index 443538a..d568e97 100644 --- a/test/pinchflat/settings_test.exs +++ b/test/pinchflat/settings_test.exs @@ -1,8 +1,8 @@ -defmodule Pinchflat.SettingsTest do +defmodule Pinchflat.SettingsBackupTest do use Pinchflat.DataCase - alias Pinchflat.Settings - alias Pinchflat.Settings.Setting + alias Pinchflat.SettingsBackup + alias Pinchflat.SettingsBackup.SettingBackup # NOTE: We're treating some of these tests differently # than in other modules because certain settings @@ -11,98 +11,98 @@ defmodule Pinchflat.SettingsTest do describe "list_settings/0" do test "returns all settings" do - Settings.set!("foo", "bar") - results = Settings.list_settings() + SettingsBackup.set!("foo", "bar") + results = SettingsBackup.list_settings() - assert Enum.all?(results, fn setting -> match?(%Setting{}, setting) end) + assert Enum.all?(results, fn setting -> match?(%SettingBackup{}, setting) end) end end describe "set/2" do test "creates a new setting if one does not exist" do - original = Repo.aggregate(Setting, :count, :id) - Settings.set!("foo", "bar") - assert Repo.aggregate(Setting, :count, :id) == original + 1 + original = Repo.aggregate(SettingBackup, :count, :id) + SettingsBackup.set!("foo", "bar") + assert Repo.aggregate(SettingBackup, :count, :id) == original + 1 end test "updates an existing setting if one exists" do - Settings.set!("foo", "bar") - original = Repo.aggregate(Setting, :count, :id) - Settings.set!("foo", "baz") - assert Repo.aggregate(Setting, :count, :id) == original - assert Settings.get!("foo") == "baz" + SettingsBackup.set!("foo", "bar") + original = Repo.aggregate(SettingBackup, :count, :id) + SettingsBackup.set!("foo", "baz") + assert Repo.aggregate(SettingBackup, :count, :id) == original + assert SettingsBackup.get!("foo") == "baz" end test "returns the parsed value" do - assert Settings.set!("foo", true) == true - assert Settings.set!("foo", false) == false - assert Settings.set!("foo", 123) == 123 - assert Settings.set!("foo", 12.34) == 12.34 - assert Settings.set!("foo", "bar") == "bar" + assert SettingsBackup.set!("foo", true) == true + assert SettingsBackup.set!("foo", false) == false + assert SettingsBackup.set!("foo", 123) == 123 + assert SettingsBackup.set!("foo", 12.34) == 12.34 + assert SettingsBackup.set!("foo", "bar") == "bar" end test "allows for atom keys" do - assert Settings.set!(:foo, "bar") == "bar" + assert SettingsBackup.set!(:foo, "bar") == "bar" end test "blows up when an unsupported datatype is used" do assert_raise FunctionClauseError, fn -> - Settings.set!("foo", nil) + SettingsBackup.set!("foo", nil) end end end describe "set/3" do test "allows manual specification of datatype" do - assert Settings.set!("foo", "true", :boolean) == true - assert Settings.set!("foo", "false", :boolean) == false - assert Settings.set!("foo", "123", :integer) == 123 - assert Settings.set!("foo", "12.34", :float) == 12.34 + assert SettingsBackup.set!("foo", "true", :boolean) == true + assert SettingsBackup.set!("foo", "false", :boolean) == false + assert SettingsBackup.set!("foo", "123", :integer) == 123 + assert SettingsBackup.set!("foo", "12.34", :float) == 12.34 end end describe "get/1" do test "returns the value of the setting" do - Settings.set!("str", "bar") - Settings.set!("bool", true) - Settings.set!("int", 123) - Settings.set!("float", 12.34) + SettingsBackup.set!("str", "bar") + SettingsBackup.set!("bool", true) + SettingsBackup.set!("int", 123) + SettingsBackup.set!("float", 12.34) - assert Settings.get!("str") == "bar" - assert Settings.get!("bool") == true - assert Settings.get!("int") == 123 - assert Settings.get!("float") == 12.34 + assert SettingsBackup.get!("str") == "bar" + assert SettingsBackup.get!("bool") == true + assert SettingsBackup.get!("int") == 123 + assert SettingsBackup.get!("float") == 12.34 end test "allows for atom keys" do - Settings.set!("str", "bar") - assert Settings.get!(:str) == "bar" + SettingsBackup.set!("str", "bar") + assert SettingsBackup.get!(:str) == "bar" end test "blows up when the setting does not exist" do assert_raise Ecto.NoResultsError, fn -> - Settings.get!("foo") + SettingsBackup.get!("foo") end end end describe "fetch/2" do test "creates a setting if one doesn't exist" do - original = Repo.aggregate(Setting, :count, :id) - assert Settings.fetch!("foo", "bar") == "bar" - assert Repo.aggregate(Setting, :count, :id) == original + 1 + original = Repo.aggregate(SettingBackup, :count, :id) + assert SettingsBackup.fetch!("foo", "bar") == "bar" + assert Repo.aggregate(SettingBackup, :count, :id) == original + 1 end test "returns an existing setting if one does exist" do - Settings.set!("foo", "bar") + SettingsBackup.set!("foo", "bar") - assert Settings.fetch!("foo", "baz") == "bar" + assert SettingsBackup.fetch!("foo", "baz") == "bar" end end describe "fetch/3" do test "allows manual specification of datatype" do - assert Settings.fetch!("foo", "true", :boolean) == true + assert SettingsBackup.fetch!("foo", "true", :boolean) == true end end end diff --git a/test/pinchflat_web/controllers/media_profile_controller_test.exs b/test/pinchflat_web/controllers/media_profile_controller_test.exs index 4a81025..55eff76 100644 --- a/test/pinchflat_web/controllers/media_profile_controller_test.exs +++ b/test/pinchflat_web/controllers/media_profile_controller_test.exs @@ -6,7 +6,7 @@ defmodule PinchflatWeb.MediaProfileControllerTest do import Pinchflat.ProfilesFixtures alias Pinchflat.Repo - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup @create_attrs %{name: "some name", output_path_template: "output_template.{{ ext }}"} @update_attrs %{ @@ -16,7 +16,7 @@ defmodule PinchflatWeb.MediaProfileControllerTest do @invalid_attrs %{name: nil, output_path_template: nil} setup do - Settings.set!(:onboarding, false) + SettingsBackup.set!(:onboarding, false) :ok end @@ -35,7 +35,7 @@ defmodule PinchflatWeb.MediaProfileControllerTest do end test "renders correct layout when onboarding", %{conn: conn} do - Settings.set!(:onboarding, true) + SettingsBackup.set!(:onboarding, true) conn = get(conn, ~p"/media_profiles/new") refute html_response(conn, 200) =~ "MENU" @@ -59,14 +59,14 @@ defmodule PinchflatWeb.MediaProfileControllerTest do end test "redirects to onboarding when onboarding", %{conn: conn} do - Settings.set!(:onboarding, true) + SettingsBackup.set!(:onboarding, true) conn = post(conn, ~p"/media_profiles", media_profile: @create_attrs) assert redirected_to(conn) == ~p"/?onboarding=1" end test "renders correct layout on error when onboarding", %{conn: conn} do - Settings.set!(:onboarding, true) + SettingsBackup.set!(:onboarding, true) conn = post(conn, ~p"/media_profiles", media_profile: @invalid_attrs) refute html_response(conn, 200) =~ "MENU" diff --git a/test/pinchflat_web/controllers/page_controller_test.exs b/test/pinchflat_web/controllers/page_controller_test.exs index 3037764..0303931 100644 --- a/test/pinchflat_web/controllers/page_controller_test.exs +++ b/test/pinchflat_web/controllers/page_controller_test.exs @@ -1,16 +1,16 @@ defmodule PinchflatWeb.PageControllerTest do use PinchflatWeb.ConnCase - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup describe "GET / when testing onboarding" do test "sets the onboarding setting to true when onboarding", %{conn: conn} do _conn = get(conn, ~p"/") - assert Settings.get!(:onboarding) + assert SettingsBackup.get!(:onboarding) end test "displays the onboarding page when onboarding is forced", %{conn: conn} do - Settings.set!(:onboarding, false) + SettingsBackup.set!(:onboarding, false) conn = get(conn, ~p"/?onboarding=1") assert html_response(conn, 200) =~ "Welcome to Pinchflat" @@ -18,14 +18,14 @@ defmodule PinchflatWeb.PageControllerTest do test "sets the onboarding setting to false if you pass the corrent query param", %{conn: conn} do conn = get(conn, ~p"/") - assert Settings.get!(:onboarding) + assert SettingsBackup.get!(:onboarding) _conn = get(conn, ~p"/?onboarding=0") - refute Settings.get!(:onboarding) + refute SettingsBackup.get!(:onboarding) end test "displays the home page when not onboarding", %{conn: conn} do - Settings.set!(:onboarding, false) + SettingsBackup.set!(:onboarding, false) conn = get(conn, ~p"/") assert html_response(conn, 200) =~ "MENU" diff --git a/test/pinchflat_web/controllers/source_controller_test.exs b/test/pinchflat_web/controllers/source_controller_test.exs index 016a01a..e291bda 100644 --- a/test/pinchflat_web/controllers/source_controller_test.exs +++ b/test/pinchflat_web/controllers/source_controller_test.exs @@ -7,13 +7,13 @@ defmodule PinchflatWeb.SourceControllerTest do import Pinchflat.ProfilesFixtures alias Pinchflat.Repo - alias Pinchflat.Settings + alias Pinchflat.SettingsBackup alias Pinchflat.Downloading.MediaDownloadWorker alias Pinchflat.SlowIndexing.MediaCollectionIndexingWorker setup do media_profile = media_profile_fixture() - Settings.set!(:onboarding, false) + SettingsBackup.set!(:onboarding, false) { :ok, @@ -47,7 +47,7 @@ defmodule PinchflatWeb.SourceControllerTest do end test "renders correct layout when onboarding", %{conn: conn} do - Settings.set!(:onboarding, true) + SettingsBackup.set!(:onboarding, true) conn = get(conn, ~p"/sources/new") refute html_response(conn, 200) =~ "MENU" @@ -74,14 +74,14 @@ defmodule PinchflatWeb.SourceControllerTest do test "redirects to onboarding when onboarding", %{conn: conn, create_attrs: create_attrs} do expect(YtDlpRunnerMock, :run, 1, &runner_function_mock/3) - Settings.set!(:onboarding, true) + SettingsBackup.set!(:onboarding, true) conn = post(conn, ~p"/sources", source: create_attrs) assert redirected_to(conn) == ~p"/?onboarding=1" end test "renders correct layout on error when onboarding", %{conn: conn, invalid_attrs: invalid_attrs} do - Settings.set!(:onboarding, true) + SettingsBackup.set!(:onboarding, true) conn = post(conn, ~p"/sources", source: invalid_attrs) refute html_response(conn, 200) =~ "MENU"