Ejemplo n.º 1
0
 def test_save_async_mdn_exception_when_msg_not_found(self):
     self.mock_cloud_data_find.side_effect = Exception('msg not found')
     headers = {'Content-Type': 'application/json', }
     body = None
     pm = PartnerManager(headers, body)
     message = jsonserializer.deserialize(TestPartnerMdnMessage.async_mdn_message_json,
                                          AsyncMdnReceive)
     pm.save_mdn_event_message(message)
Ejemplo n.º 2
0
 def test_save_async_mdn_ok(self):
     headers = {'Content-Type': 'application/json', }
     body = None
     pm = PartnerManager(headers, body)
     message = jsonserializer.deserialize(TestPartnerMdnMessage.async_mdn_message_json,
                                          AsyncMdnReceive)
     msg = pm.save_mdn_event_message(message)
     assert_not_equal(None, msg)
     assert_not_equal(None, msg.message_mdn)
Ejemplo n.º 3
0
def post_mdn_message_save(domain):
    logger.debug(
        'received internal mdn-event-message from domain:{0} , uri:{1} ,query_string:{2}'
        .format(domain, request.url, request.query_string))
    try:
        async_mdn = get_request_entity(AsyncMdnReceive)

        message = PartnerManager.save_mdn_event_message(async_mdn)

        return build_response(200,
                              resp_entity=MessageResponse(is_succeed=True,
                                                          message=message))
    except:
        logger.exception('mdn-event-message store failed')
        return build_response(500,
                              resp_entity=GeneralResponse(
                                  is_succeed=False,
                                  error_message=str(sys.exc_info()[1])))