Beispiel #1
0
    def test_01_xml_payment_tsys(self):
        # Run the http post request in background and add the result to queue
        run_in_background(post_xml_payment)

        # Get the message from the rest interface incoming message queue
        print("getting message from incoming queue")
        msg = json2dict(q.dequeue("incoming", 0))

        # Assert that request was added to message queue
        assert msg is not None
        print(msg)

        txn_type = msg.iterkeys().next()
        print("txn_type: " + txn_type)
        guid = str(msg[txn_type]["guid"])

        # Create a core response
        core_rsp = create_core_rsp(guid)
        print("core_rsp: " + core_rsp)
        # print('setting ' + guid + ' to queue')

        # Put the response on the outgoing queue
        q.enqueue(guid, core_rsp)

        # Get the result from the queue
        http_rsp = get_result()
        assert http_rsp.status_code == requests.codes.ok
        print(http_rsp.headers.get("Content-Type"))
        assert get_content_type(http_rsp) == http.MimeType.app_xml
Beispiel #2
0
def publish_status(status):
	log.info('publishing status: ' + status)
	q.enqueue('route-status', route_name + ':' + status)
Beispiel #3
0
def send_to_core(msg):
	if isinstance(msg, dict):
		msg = dict_to_json(msg)
	log.info('sending message ' + msg + ' to queue incoming')

	q.enqueue('incoming', msg, 0)