

@mock.patch('website.mailchimp_utils.get_mailchimp_api')
def test_get_list_name_from_id(self, mock_get_mailchimp_api):
    list_id = '12345'
    mock_client = mock.MagicMock()
    mock_get_mailchimp_api.return_value = mock_client
    self.lists.list.return_value = {
        'data': [{
            'id': list_id,
            'name': 'foo',
        }],
    }
    list_name = mailchimp_utils.get_list_name_from_id(list_id)
    mock_client.lists.list.assert_called_with(filters={
        'list_id': list_id,
    })
    assert_equal(list_name, 'foo')

dataset/ETHPy150Open CenterForOpenScience/osf.io/tests/test_mailchimp.py TestMailChimpHelpers.test_get_list_name_from_id/VarMisuse@38/85 `mock_client`->`self`