

@mock.patch('website.mailchimp_utils.mailchimp.Lists.list')
@mock.patch('website.mailchimp_utils.mailchimp.Lists.batch_subscribe')
def test_subscribe_users_called_with_correct_arguments(self, mock_subscribe, mock_list):
    mock_list.return_value = {
        'data': [{
            'id': 1,
            'list_name': GENERAL_LIST,
        }],
    }
    list_id = mailchimp_utils.get_list_id_from_name(GENERAL_LIST)
    users = list(get_users())
    subscribe_users(users, dry=False)
    serialized = [serialize_user(u) for u in users]
    mock_subscribe.assert_called_with(id=list_id, batch=u, double_optin=False, update_existing=True)

dataset/ETHPy150Open CenterForOpenScience/osf.io/scripts/sync_email.py TestSyncEmail.test_subscribe_users_called_with_correct_arguments/VarMisuse@107/186 `serialized`->`u`