def test_should_put_transport_info_in_request_for_sms_submission(self):
     processor = SMSTransportInfoRequestProcessor()
     processor.process(self.http_request, self.mangrove_request)
     self.assertEqual(SMS,
                      self.mangrove_request['transport_info'].transport)
     self.assertEqual(self.from_number,
                      self.mangrove_request['transport_info'].source)
     self.assertEqual(self.to_number,
                      self.mangrove_request['transport_info'].destination)
Example #2
0
def find_dbm(request):
    incoming_request = {}
    #This is the http post request. After this state, the request being sent is a python dictionary
    SMSMessageRequestProcessor().process(http_request=request, mangrove_request=incoming_request)
    SMSTransportInfoRequestProcessor().process(http_request=request, mangrove_request=incoming_request)
    organization, error = _get_organization(request)

    if error is not None:
        incoming_request['outgoing_message'] = error
        create_failure_log(error, incoming_request)
        return incoming_request

    incoming_request['dbm'] = get_database_manager_for_org(organization)
    incoming_request['organization'] = organization

    incoming_request['next_state'] = process_sms_counter
    return incoming_request
Example #3
0
def find_dbm(request):
    send_to_carbon(create_path('submissions.sms'), 1)
    incoming_request = {}
    # This is the http post request. After this state, the request being sent is a python dictionary
    SMSMessageRequestProcessor().process(http_request=request, mangrove_request=incoming_request)
    SMSTransportInfoRequestProcessor().process(http_request=request, mangrove_request=incoming_request)
    organization, error = _get_organization(request)

    if error is not None:
        incoming_request['outgoing_message'] = error
        create_failure_log(error, incoming_request)
        return incoming_request

    incoming_request['dbm'] = get_database_manager_for_org(organization)
    incoming_request['feeds_dbm'] = get_feeds_db_for_org(organization)
    incoming_request['organization'] = organization
    incoming_request['message_id'] = request.POST.get('message_id')
    translation.activate(organization.language)

    incoming_request['next_state'] = check_account_and_datasender
    return incoming_request