File: utils.py

package info (click to toggle)
python-carrot 0.10.5-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 492 kB
  • ctags: 508
  • sloc: python: 2,477; makefile: 75
file content (28 lines) | stat: -rw-r--r-- 877 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import os

from carrot.connection import BrokerConnection


BROKER_HOST = os.environ.get('BROKER_HOST', "localhost")
BROKER_PORT = os.environ.get('BROKER_PORT', 5672)
BROKER_VHOST = os.environ.get('BROKER_VHOST', "/")
BROKER_USER = os.environ.get('BROKER_USER', "guest")
BROKER_PASSWORD = os.environ.get('BROKER_PASSWORD', "guest")

STOMP_HOST = os.environ.get('STOMP_HOST', 'localhost')
STOMP_PORT = os.environ.get('STOMP_PORT', 61613)
STOMP_QUEUE = os.environ.get('STOMP_QUEUE', '/queue/testcarrot')


def test_connection_args():
    return {"hostname": BROKER_HOST, "port": BROKER_PORT,
            "virtual_host": BROKER_VHOST, "userid": BROKER_USER,
            "password": BROKER_PASSWORD}


def test_stomp_connection_args():
    return {"hostname": STOMP_HOST, "port": STOMP_PORT}


def establish_test_connection():
    return BrokerConnection(**test_connection_args())