Testing a controller that makes outside api calls

Yes, you can :slight_smile:

This is what I do:

config/test.exs:

config :app, :api_endpoint, "http://localhost:9999"

In your test:

setup do

  bypass = Bypass.open(port: 9999)
  ...
end

As you can see, by passing the port option, you can tell Bypass which port to use. This allows you to configure the URL globally. This test can now run asynchronously with other tests, as it doesn’t need to overwrite the global test configuration.

I hope this helps.