예제 #1
0
def test_get_context_order_create():
    context = get_context('routing-keys/order-service.auto.order.created.json')
    assert type(context) is CreateOrderContext
예제 #2
0
def test_get_context_bad_action():
    with pytest.raises(KeyError):
        get_context('routing-keys/order-service.auto.order.creatd.json')

    with pytest.raises(KeyError):
        get_context('routing-keys/policy-service.auto.order.ac.json')
예제 #3
0
def test_get_context_bad_service():
    with pytest.raises(KeyError):
        get_context('routing-keys/a.auto.order.created.json')
예제 #4
0
def test_get_context_policy_refuse():
    context = get_context('routing-keys/policy-service.auto.policy.refused.json')
    assert type(context) is UpdatePolicyContext
예제 #5
0
def test_get_context_policy_create():
    context = get_context('routing-keys/policy-service.auto.policy.created.json')
    assert type(context) is CreatePolicyContext
예제 #6
0
from argparse import ArgumentParser

from Context import get_context

if __name__ == '__main__':
    parser = ArgumentParser(description='Process events')
    parser.add_argument('file_path', type=str)
    file_path = parser.parse_args().file_path

    context = get_context(file_path)
    context.process()