Don't load Last.fm credentials from env in test
This commit is contained in:
+14
-12
@@ -20,18 +20,6 @@ if System.get_env("PHX_SERVER") do
|
|||||||
config :music_library, MusicLibraryWeb.Endpoint, server: true
|
config :music_library, MusicLibraryWeb.Endpoint, server: true
|
||||||
end
|
end
|
||||||
|
|
||||||
if api_key = System.get_env("LAST_FM_API_KEY") do
|
|
||||||
config :music_library, LastFm, api_key: api_key
|
|
||||||
end
|
|
||||||
|
|
||||||
if shared_secret = System.get_env("LAST_FM_SHARED_SECRET") do
|
|
||||||
config :music_library, LastFm, shared_secret: shared_secret
|
|
||||||
end
|
|
||||||
|
|
||||||
if user = System.get_env("LAST_FM_USER") do
|
|
||||||
config :music_library, LastFm, user: user
|
|
||||||
end
|
|
||||||
|
|
||||||
if openai_key = System.get_env("OPENAI_KEY") do
|
if openai_key = System.get_env("OPENAI_KEY") do
|
||||||
config :music_library, OpenAI, api_key: openai_key
|
config :music_library, OpenAI, api_key: openai_key
|
||||||
end
|
end
|
||||||
@@ -64,6 +52,20 @@ config :music_library, MusicLibrary.Vault,
|
|||||||
tag: "AES.GCM.V1", key: Base.decode64!(cloak_encryption_key), iv_length: 12}
|
tag: "AES.GCM.V1", key: Base.decode64!(cloak_encryption_key), iv_length: 12}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if config_env() !== :test do
|
||||||
|
if api_key = System.get_env("LAST_FM_API_KEY") do
|
||||||
|
config :music_library, LastFm, api_key: api_key
|
||||||
|
end
|
||||||
|
|
||||||
|
if shared_secret = System.get_env("LAST_FM_SHARED_SECRET") do
|
||||||
|
config :music_library, LastFm, shared_secret: shared_secret
|
||||||
|
end
|
||||||
|
|
||||||
|
if user = System.get_env("LAST_FM_USER") do
|
||||||
|
config :music_library, LastFm, user: user
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if config_env() == :prod do
|
if config_env() == :prod do
|
||||||
database_path =
|
database_path =
|
||||||
System.get_env("DATABASE_PATH") ||
|
System.get_env("DATABASE_PATH") ||
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ defmodule LastFmTest do
|
|||||||
{:ok, body, conn} = Plug.Conn.read_body(conn)
|
{:ok, body, conn} = Plug.Conn.read_body(conn)
|
||||||
|
|
||||||
assert body ==
|
assert body ==
|
||||||
"album%5B0%5D=Dominion&api_key=48df017be28e54860d2f3756b229c91a&api_sig=3654e07703b66d58e7c6f36a3eff7747&artist%5B0%5D=IQ&format=json&mbid%5B0%5D=aefaaf73-b52c-4b0d-91df-f8e4321db2bd&method=track.scrobble&sk=session_key×tamp%5B0%5D=1746561301&track%5B0%5D=Wonderland"
|
"album%5B0%5D=Dominion&api_key=change+me&api_sig=f3c0644ba671654aafb2396806c4b96f&artist%5B0%5D=IQ&format=json&mbid%5B0%5D=aefaaf73-b52c-4b0d-91df-f8e4321db2bd&method=track.scrobble&sk=session_key×tamp%5B0%5D=1746561301&track%5B0%5D=Wonderland"
|
||||||
|
|
||||||
Req.Test.json(conn, response_body)
|
Req.Test.json(conn, response_body)
|
||||||
end)
|
end)
|
||||||
|
|||||||
Reference in New Issue
Block a user