To get the search result that we're asking for in the new functional test without adding it to the database, we're going to extend the search view to do a
search_artists() at MB. That's exactly the kind of external integration that we should mock out in our test.
A mock is simply a replacement for an object or function in the context of a single test. There are several reasons you might want to mock out external (or even internal) code, particularly in unit tests:
If our unit test is dependent on an external system working, doesn't that mean our test is not testing a single unit? And if the external system fails, is it really fair to fail the test of our code? A mock guarantees that we get the response ...