My test:
@non_existent_profile %{
"login" => "non-existent-user",
"pass" => Base.encode64("non-existent-pass")
}
test "should return 401 for non-existent user", %{conn: conn} do
assert _ =
conn
|> post(Routes.auth_token_path(conn, :create), @non_existent_profile)
|> json_response(401)
end
end
Output in console:
GetmsgApi.AuthTokenControllerTest [test/getmsg_api/controllers/auth_token_controller_test.exs]
* test should return 401 for non-existent user [L#28]09:23:24.632 [warning] state=set duration=0.113 status=401 params={"login":"non-existent-user","pass":"bm9uLWV4aXN0ZW50LXBhc3M="} path=/getmsg/api/auth-tokens method=POST format=json controller=GetmsgApi.AuthTokenController action=create erl_level=warning application=logster domain=elixir file=lib/logster/plugs/logger.ex function=call/2 line=40 mfa=Logster.Plugs.Logger.call/2 module=Logster.Plugs.Logger pid=<0.1921.0> request_id=F1NOJIEzwahS0w4AAAnh
* test should return 401 for non-existent user (3.7ms) [L#28]
I tried configure Logster in TestEndpoint
plug Logster.Plugs.Logger, to: :error
But this didn’t work. How should I do to make the warnings go away?
My app is part of umbrella application. I need to remove warnings only in my app in test env.