@mock.patch(PYCOUNTRY)
def test_title_case_is_applied(self, mocked_pycountry):
    expected_calls = []
    names = ['united kingdom', 'UNITED KINGDOM', 'United kingdom']
    mocked_pycountry.side_effect = ([KeyError(), KeyError(), KeyError(), 'blah'] * len(names))
    for name in names:
        country_iso_code(name)
        raw_call = mock.call(name=name)
        common_call = mock.call(common_name=name)
        official_call = mock.call(official_name=name)
        title_call = mock.call(name='United Kingdom')
        expected_calls.append(raw_call)
        expected_calls.append(common_call)
        expected_calls.append(official_call)
        expected_calls.append(title_call)
    assert (mocked_pycountry.mock_calls == expected_calls)
@mock.patch(PYCOUNTRY)
def test_title_case_is_applied(self, mocked_pycountry):
    expected_calls = []
    names = ['united kingdom', 'UNITED KINGDOM', 'United kingdom']
    mocked_pycountry.side_effect = ([KeyError(), KeyError(), KeyError(), 'blah'] * len(names))
    for name in names:
        country_iso_code(name)
        raw_call = mock.call(name=name)
        common_call = mock.call(common_name=name)
        official_call = mock.call(official_name=name)
        title_call = mock.call(name='United Kingdom')
        expected_calls.append(raw_call)
        expected_calls.append(common_call)
        expected_calls.append(official_call)
        expected_calls.append(title_call)
    assert (mocked_pycountry.mock_calls == expected_calls)