Global State in tests

My solution to this to get the token in test_helper.exs put it in the env and then in test’s setup pick the token from the env for the tests that need it.

Application.put_env(
  :app,
  :token_key,
  get_token()
)
// test
  setup_all do
    token = Application.get_env(:app, :token_key)