summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorIlja <ilja@ilja.space>2022-02-22 18:18:10 +0100
committerIlja <ilja@ilja.space>2022-07-01 12:15:02 +0200
commit81afaee37436f1802f4e0a6d33d9bb8121e51f48 (patch)
treef6a9cb47869589e0211c0a53ca41eaa202d4f569 /test
parent75ea766824a5d7714fbea5d24e59444c7adfc274 (diff)
downloadpleroma-81afaee37436f1802f4e0a6d33d9bb8121e51f48.tar.gz
pleroma-81afaee37436f1802f4e0a6d33d9bb8121e51f48.zip
Better way of getting keys
I used keyword_list[:key], but if the key doesn't exist, it will return nil. I actually expect a list and further down the code I use that list. I believe the key should always be present, but in case it's not, it's better to return an empty list instead of nil. That way the code wont fail further down the line.
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/config/deprecation_warnings_test.exs2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/pleroma/config/deprecation_warnings_test.exs b/test/pleroma/config/deprecation_warnings_test.exs
index ffd446909..f3453ddb0 100644
--- a/test/pleroma/config/deprecation_warnings_test.exs
+++ b/test/pleroma/config/deprecation_warnings_test.exs
@@ -51,7 +51,7 @@ defmodule Pleroma.Config.DeprecationWarningsTest do
capture_log(fn -> DeprecationWarnings.warn() end)
- assert Config.get([Pleroma.Upload])[:filters] == expected_config
+ assert Config.get([Pleroma.Upload]) |> Keyword.get(:filters, []) == expected_config
end
test "doesn't give a warning with correct config" do