예제 #1
0
def test_sqs_route_keep_message_translator(dummy_handler):
    route = SQSRoute("what",
                     handler=dummy_handler,
                     message_translator=SNSMessageTranslator())
    assert isinstance(route.message_translator, SNSMessageTranslator)
    route = SQSRoute("what", handler=dummy_handler, message_translator=None)
    assert route.message_translator is None
예제 #2
0
def test_sqs_route(dummy_handler):
    route = SQSRoute("what", handler=dummy_handler)
    assert isinstance(route.message_translator, SQSMessageTranslator)
    assert isinstance(route.provider, SQSProvider)
    assert route.name == "what"
예제 #3
0
def test_sqs_route_provider_options(dummy_handler):
    route = SQSRoute("what", {"use_ssl": False},
                     handler=dummy_handler,
                     name="foobar")
    assert "use_ssl" in route.provider._client_options
    assert route.provider._client_options["use_ssl"] is False
예제 #4
0
def test_sqs_route_keep_name(dummy_handler):
    route = SQSRoute("what", handler=dummy_handler, name="foobar")
    assert route.name == "foobar"
예제 #5
0
from loafer.ext.aws.routes import SQSRoute
from .handlers import print_handler, error_handler
from .settings import settings

routes = (SQSRoute(
    settings.SQS_QUEUE_NAME,
    {'options': {
        'WaitTimeSeconds': 3
    }},
    handler=print_handler,
    error_handler=error_handler,
), )
예제 #6
0
def test_sqs_route_provider_options(dummy_handler):
    route = SQSRoute('what', {'use_ssl': False},
                     handler=dummy_handler,
                     name='foobar')
    assert 'use_ssl' in route.provider._client_options
    assert route.provider._client_options['use_ssl'] is False
예제 #7
0
def test_sqs_route_keep_name(dummy_handler):
    route = SQSRoute('what', handler=dummy_handler, name='foobar')
    assert route.name == 'foobar'
예제 #8
0
from loafer.ext.aws.routes import SQSRoute
from .handlers import handler_add
from .handlers import error_handler
from decouple import config


routes = (
    SQSRoute(config('QUEUE_NAME', 'loafer-test'),
             {'options': {'WaitTimeSeconds': 3}},
             handler=handler_add,
             error_handler=error_handler),
)