

@allow_remote_invocation
def send_sample_sms(self, data):
    request_token = outgoing_sms_form_valid.get('request_token')
    if (not self.get_cached_webhook_secret(request_token)):
        return {
            'success': False,
            'unexpected_error': self.unexpected_error,
        }
    outgoing_sms_form = TelerivetOutgoingSMSForm({
        'api_key': data.get('api_key'),
        'project_id': data.get('project_id'),
        'phone_id': data.get('phone_id'),
    })
    test_sms_form = TelerivetPhoneNumberForm({
        'test_phone_number': data.get('test_phone_number'),
    })
    outgoing_sms_form_valid = outgoing_sms_form.is_valid()
    test_sms_form_valid = test_sms_form.is_valid()
    if ((not outgoing_sms_form_valid) or (not test_sms_form_valid)):
        return {
            'success': False,
            'api_key_error': self.get_error_message(outgoing_sms_form, 'api_key'),
            'project_id_error': self.get_error_message(outgoing_sms_form, 'project_id'),
            'phone_id_error': self.get_error_message(outgoing_sms_form, 'phone_id'),
            'test_phone_number_error': self.get_error_message(test_sms_form, 'test_phone_number'),
        }
    tmp_backend = SQLTelerivetBackend()
    tmp_backend.set_extra_fields(api_key=outgoing_sms_form.cleaned_data.get('api_key'), project_id=outgoing_sms_form.cleaned_data.get('project_id'), phone_id=outgoing_sms_form.cleaned_data.get('phone_id'))
    sms = SMS(phone_number=clean_phone_number(test_sms_form.cleaned_data.get('test_phone_number')), text='This is a test SMS from CommCareHQ.')
    tmp_backend.send(sms)
    return {
        'success': True,
    }

dataset/ETHPy150Open dimagi/commcare-hq/corehq/messaging/smsbackends/telerivet/views.py TelerivetSetupView.send_sample_sms/VarMisuse@17/25 `data`->`outgoing_sms_form_valid`