class CreateSearchUseCaseTests(unittest.TestCase):
    def setUp(self):
        super(CreateSearchUseCaseTests, self).setUp()
        self.repository = FakeSearchRepository()

        self.subject = CreateSearchUseCase(search_repository=self.repository)

    def test_create_search_with_valid_county_and_address_notifies_observer(self):
        observer = FakeCreateObserver()
        self.subject.execute(address="125 Jones St", county="sanfrancisco", observer=observer)

        search = None

        def fetch_success(incoming_search):
            nonlocal search
            search = incoming_search

        fetch_failure = lambda x, y: None
        self.repository.fetch_search(
            identifier=observer.created_identifier, success=fetch_success, failure=fetch_failure
        )

        expected_fetched_search = Search(county="sanfrancisco", address="125 Jones St")

        assert_searches_equal(observer.created_search, expected_fetched_search, self)
    def setUp(self):
        super(CreateSearchUseCaseTests, self).setUp()
        self.repository = FakeSearchRepository()

        self.subject = CreateSearchUseCase(search_repository=self.repository)