# Testing a controller that makes outside api calls

**URL:** <https://forum.elixirforum.com/t/testing-a-controller-that-makes-outside-api-calls/45992>\
**Category:** Questions\
**Tags:** phoenix, testing, apis\
**Created:** [February 11, 2022, 6:51pm UTC](https://forum.elixirforum.com/t/testing-a-controller-that-makes-outside-api-calls/45992 "2022-02-11T18:51:03Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![crispinb](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/crispinb/32/22642_2.png) [@crispinb](https://forum.elixirforum.com/u/crispinb)\
**Post date:** [February 12, 2022, 12:29am UTC](https://forum.elixirforum.com/t/testing-a-controller-that-makes-outside-api-calls/45992/11 "2022-02-12T00:29:41Z")

</div>

> [@dimitarvp](#):
>
> To alleviate the risk of falling into the trap of wishful thinking that mocking incurs, just use `curl` (or Postman, Insomnia etc.) to download responses from the actual live API, save them on your machine and then make text fixtures out of them.

Excellent advice. This also encourages you to keep your mocks thin, and makes use of the API data easy to expand as needs dictate. Maybe this is just me, but I have a tendency to pluck the few values from the API return I think I need for my model, only to find later there’s gold there that I missed. With raw api returns available locally, everything’s always there to be mined later.

---

_[View the full topic](https://forum.elixirforum.com/t/testing-a-controller-that-makes-outside-api-calls/45992)._
