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 recv_from_core(guid):
	rsp = q.dequeue(guid, 0)
	print('response received')
	print(rsp)
	if isinstance(rsp, str):
		rsp = json_to_dict(rsp)
	return rsp
Beispiel #3
0
	def monitor_routes(self):
		while True:
			# check if new routes are offline/online
			rsp = q.dequeue('route-status-publish', 100)
			if rsp == 'all:republish':
				log.info('republish message received - republishing status')
				publish_status('online')
			time.sleep(0.25)
Beispiel #4
0
	def check_route_status(s):
		status = None
		rsp = q.dequeue('route-status', 100)
		if rsp:
			log.info('route status: ' + rsp)
			route, status = rsp.split(':')
		if status == 'online':
			s.mark_route_online(route)
		if status == 'offline':
			s.mark_route_offline(route)